Jacek Caban : mshtml: Release ActiveX object interfaces in detach_plugin_host.

Alexandre Julliard julliard at winehq.org
Mon Jan 27 13:32:52 CST 2014


Module: wine
Branch: master
Commit: e2d04d3dec8d560a5a9d26f453fa63a304aadba2
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e2d04d3dec8d560a5a9d26f453fa63a304aadba2

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Tue Jan 21 15:54:42 2014 +0100

mshtml: Release ActiveX object interfaces in detach_plugin_host.

---

 dlls/mshtml/pluginhost.c |   32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c
index 38a8fd5..7c1b760 100644
--- a/dlls/mshtml/pluginhost.c
+++ b/dlls/mshtml/pluginhost.c
@@ -893,6 +893,29 @@ static ULONG WINAPI PHClientSite_AddRef(IOleClientSite *iface)
     return ref;
 }
 
+static void release_plugin_ifaces(PluginHost *This)
+{
+    if(This->disp) {
+        IDispatch_Release(This->disp);
+        This->disp = NULL;
+    }
+
+    if(This->ip_object) {
+        IOleInPlaceObject_Release(This->ip_object);
+        This->ip_object = NULL;
+    }
+
+    if(This->plugin_unk) {
+        IUnknown *unk = This->plugin_unk;
+        LONG ref;
+
+        This->plugin_unk = NULL;
+        ref = IUnknown_Release(unk);
+
+        TRACE("plugin ref = %d\n", ref);
+    }
+}
+
 static ULONG WINAPI PHClientSite_Release(IOleClientSite *iface)
 {
     PluginHost *This = impl_from_IOleClientSite(iface);
@@ -901,10 +924,7 @@ static ULONG WINAPI PHClientSite_Release(IOleClientSite *iface)
     TRACE("(%p) ref=%d\n", This, ref);
 
     if(!ref) {
-        if(This->disp)
-            IDispatch_Release(This->disp);
-        if(This->ip_object)
-            IOleInPlaceObject_Release(This->ip_object);
+        release_plugin_ifaces(This);
         if(This->sink) {
             This->sink->host = NULL;
             IDispatch_Release(&This->sink->IDispatch_iface);
@@ -913,8 +933,6 @@ static ULONG WINAPI PHClientSite_Release(IOleClientSite *iface)
         list_remove(&This->entry);
         if(This->element)
             This->element->plugin_host = NULL;
-        if(This->plugin_unk)
-            IUnknown_Release(This->plugin_unk);
         heap_free(This);
     }
 
@@ -1687,6 +1705,8 @@ void detach_plugin_host(PluginHost *host)
         host->sink = NULL;
     }
 
+    release_plugin_ifaces(host);
+
     if(host->element) {
         host->element->plugin_host = NULL;
         host->element = NULL;




More information about the wine-cvs mailing list