mshtml: Deactivate plugin when detaching from document.

This commit is contained in:
Jacek Caban 2010-12-13 16:00:37 +01:00 committed by Alexandre Julliard
parent c65f4c4956
commit 52cc865cdc
5 changed files with 34 additions and 9 deletions

View File

@ -1898,9 +1898,11 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface)
detach_selection(This);
detach_ranges(This);
detach_plugin_hosts(This);
release_nodes(This);
while(!list_empty(&This->plugin_hosts))
detach_plugin_host(LIST_ENTRY(list_head(&This->plugin_hosts), PluginHost, entry));
if(This->nsdoc) {
release_mutation(This);
nsIDOMHTMLDocument_Release(This->nsdoc);

View File

@ -423,7 +423,7 @@ static void HTMLObjectElement_destructor(HTMLDOMNode *iface)
HTMLObjectElement *This = HTMLOBJECT_NODE_THIS(iface);
if(This->plugin_container.plugin_host)
This->plugin_container.plugin_host->element = NULL;
detach_plugin_host(This->plugin_container.plugin_host);
if(This->nsobject)
nsIDOMHTMLObjectElement_Release(This->nsobject);

View File

@ -296,6 +296,7 @@ static NPError CDECL NPP_Destroy(NPP instance, NPSavedData **save)
if(!host)
return NPERR_GENERIC_ERROR;
detach_plugin_host(host);
IOleClientSite_Release(&host->IOleClientSite_iface);
instance->pdata = NULL;
return NPERR_NO_ERROR;

View File

@ -954,15 +954,37 @@ static HRESULT assoc_element(PluginHost *host, HTMLDocumentNode *doc, nsIDOMElem
return S_OK;
}
void detach_plugin_hosts(HTMLDocumentNode *doc)
void detach_plugin_host(PluginHost *host)
{
PluginHost *iter;
HRESULT hres;
while(!list_empty(&doc->plugin_hosts)) {
iter = LIST_ENTRY(list_head(&doc->plugin_hosts), PluginHost, entry);
list_remove(&iter->entry);
iter->doc = NULL;
TRACE("%p\n", host);
if(!host->doc)
return;
if(host->ip_object)
IOleInPlaceObject_InPlaceDeactivate(host->ip_object);
if(host->plugin_unk) {
IOleObject *ole_obj;
hres = IUnknown_QueryInterface(host->plugin_unk, &IID_IOleObject, (void**)&ole_obj);
if(SUCCEEDED(hres)) {
if(!host->ip_object)
IOleObject_Close(ole_obj, OLECLOSE_NOSAVE);
IOleObject_SetClientSite(ole_obj, NULL);
IOleObject_Release(ole_obj);
}
}
if(host->element) {
host->element->plugin_host = NULL;
host->element = NULL;
}
list_remove(&host->entry);
host->doc = NULL;
}
HRESULT create_plugin_host(HTMLDocumentNode *doc, nsIDOMElement *nselem, IUnknown *unk, const CLSID *clsid, PluginHost **ret)

View File

@ -52,6 +52,6 @@ extern const IID IID_HTMLPluginContainer;
HRESULT create_plugin_host(HTMLDocumentNode*,nsIDOMElement*,IUnknown*,const CLSID*,PluginHost**);
void update_plugin_window(PluginHost*,HWND,const RECT*);
void detach_plugin_hosts(HTMLDocumentNode*);
void detach_plugin_host(PluginHost*);
HRESULT create_param_prop_bag(nsIDOMHTMLElement*,IPropertyBag**);