Module: wine Branch: master Commit: 52cc865cdc2fd060f6bc4a0588cbf310a2dd809e URL: http://source.winehq.org/git/wine.git/?a=commit;h=52cc865cdc2fd060f6bc4a0588...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Dec 13 16:00:37 2010 +0100
mshtml: Deactivate plugin when detaching from document.
---
dlls/mshtml/htmldoc.c | 4 +++- dlls/mshtml/htmlobject.c | 2 +- dlls/mshtml/npplugin.c | 1 + dlls/mshtml/pluginhost.c | 34 ++++++++++++++++++++++++++++------ dlls/mshtml/pluginhost.h | 2 +- 5 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index a4c1451..7cfa273 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -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); diff --git a/dlls/mshtml/htmlobject.c b/dlls/mshtml/htmlobject.c index c911dd8..1cb8d60 100644 --- a/dlls/mshtml/htmlobject.c +++ b/dlls/mshtml/htmlobject.c @@ -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);
diff --git a/dlls/mshtml/npplugin.c b/dlls/mshtml/npplugin.c index ad88da2..20a30ab 100644 --- a/dlls/mshtml/npplugin.c +++ b/dlls/mshtml/npplugin.c @@ -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; diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c index 8a7e2a6..bce884e 100644 --- a/dlls/mshtml/pluginhost.c +++ b/dlls/mshtml/pluginhost.c @@ -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; + + TRACE("%p\n", host); + + if(!host->doc) + return; + + if(host->ip_object) + IOleInPlaceObject_InPlaceDeactivate(host->ip_object);
- while(!list_empty(&doc->plugin_hosts)) { - iter = LIST_ENTRY(list_head(&doc->plugin_hosts), PluginHost, entry); - list_remove(&iter->entry); - iter->doc = NULL; + 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) diff --git a/dlls/mshtml/pluginhost.h b/dlls/mshtml/pluginhost.h index 30af989..135b2a8 100644 --- a/dlls/mshtml/pluginhost.h +++ b/dlls/mshtml/pluginhost.h @@ -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**);