diff --git a/docs/ReleaseNotes.html b/docs/ReleaseNotes.html index b648a0b..a5dd939 100644 --- a/docs/ReleaseNotes.html +++ b/docs/ReleaseNotes.html @@ -30,6 +30,10 @@ 1465539 (pre-release 1) IEnumVariant leak fixed in patch 1674179 + + 1699946 + (pre-release 5) Unrecognized event callback id leaves thread attached to VM when ComFailException is thrown. +     diff --git a/jni/EventProxy.cpp b/jni/EventProxy.cpp index 6172630..8d00871 100644 --- a/jni/EventProxy.cpp +++ b/jni/EventProxy.cpp @@ -139,6 +139,12 @@ STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid, eventMethodName = W2A((OLECHAR *)MethName[i]); } } + // added 1.12 + if (!eventMethodName) { + // just bail if can't find signature. no need to attach + // printf("Invoke: didn't find method name for dispatch id %d\n",dispID); + return S_OK; + } if (DISPATCH_METHOD & wFlags) { @@ -153,11 +159,12 @@ STDMETHODIMP EventProxy::Invoke(DISPID dispID, REFIID riid, if (!eventMethodName) { - // user did not implement this method - // printf("Invoke: didn't find method name\n"); + // could not find this signature in list + // printf("Invoke: didn't find method name for dispatch id %d\n",dispID); + // this probably leaves a native thread attached to the vm when we don't want it ThrowComFail(env, "Event method received was not defined as part of callback interface", -1); - // should we detatch before returning?? The old code didn't but I don't see why not. + // should we detatch before returning?? We probably never get here if we ThrowComFail() // jvm->DetachCurrentThread(); return S_OK; }