3412922Fix for: When a DispatchEvent is created with a COM object, the COM object is never released totally, and the destructor function is never called
This commit is contained in:
@@ -15,6 +15,10 @@
|
||||
<tr>
|
||||
<td colspan="2"><b>Bugs</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="13%" valign="top">3412922</td>
|
||||
<td width="87%" valign="top">(M1)Fix for: When a DispatchEvent is created with a COM object, the COM object is never released totally, and the destructor function is never called.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="13%" valign="top"> </td>
|
||||
<td width="87%" valign="top"> </td>
|
||||
|
||||
@@ -153,6 +153,9 @@ JNIEXPORT void JNICALL Java_com_jacob_com_DispatchEvents_release
|
||||
{
|
||||
EventProxy *ep = extractProxy(env, _this);
|
||||
if (ep) {
|
||||
// Disconnect must be called to reduce the ref count to the EventProxy otherwise
|
||||
// the destructor will never be called (to actually do the disconnect)
|
||||
ep->Disconnect(); // SF 3412922
|
||||
// this is the line that blows up in IETest
|
||||
ep->Release();
|
||||
putProxy(env, _this, NULL);
|
||||
|
||||
@@ -100,6 +100,8 @@ EventProxy::~EventProxy()
|
||||
|
||||
void EventProxy::Disconnect() {
|
||||
if (connected) {
|
||||
// insure we don't call Unadvise twice
|
||||
connected = 0;
|
||||
pCP->Unadvise(dwEventCookie);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ private:
|
||||
JavaVM *jvm; // The java vm we are running
|
||||
void convertJavaVariant(VARIANT *java, VARIANT *com);
|
||||
void Connect(JNIEnv *env);
|
||||
void Disconnect();
|
||||
public:
|
||||
// constuct with a global JNI ref to a sink object
|
||||
// to which we will delegate event callbacks
|
||||
@@ -98,4 +97,7 @@ public:
|
||||
// These are the actual supported methods
|
||||
STDMETHODIMP GetIDsOfNames(REFIID, OLECHAR **, UINT, LCID , DISPID *);
|
||||
STDMETHODIMP Invoke(DISPID, REFIID, LCID, WORD , DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *);
|
||||
// SF 3412922 make public to support cleanup from DispatchEvents
|
||||
void Disconnect();
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user