mshtml: Release ActiveX object interfaces in detach_plugin_host.

This commit is contained in:
Jacek Caban 2014-01-21 15:54:42 +01:00 committed by Alexandre Julliard
parent e7c9e32d7d
commit e2d04d3dec
1 changed files with 26 additions and 6 deletions

View File

@ -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;