Jacek Caban : mshtml: Associate PluginHost with containing HTMLDocumentDode .
Module: wine Branch: master Commit: b962fff243906ba56295aeeacf66142f0388638b URL: http://source.winehq.org/git/wine.git/?a=commit;h=b962fff243906ba56295aeeacf... Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Dec 9 16:27:51 2010 +0100 mshtml: Associate PluginHost with containing HTMLDocumentDode. --- dlls/mshtml/htmldoc.c | 3 +++ dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/npplugin.c | 2 +- dlls/mshtml/pluginhost.c | 17 ++++++++++++++++- dlls/mshtml/pluginhost.h | 6 +++++- 5 files changed, 26 insertions(+), 3 deletions(-) diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index e9a0cd6..a4c1451 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -35,6 +35,7 @@ #include "mshtml_private.h" #include "htmlevent.h" +#include "pluginhost.h" WINE_DEFAULT_DEBUG_CHANNEL(mshtml); @@ -1897,6 +1898,7 @@ static void HTMLDocumentNode_destructor(HTMLDOMNode *iface) detach_selection(This); detach_ranges(This); + detach_plugin_hosts(This); release_nodes(This); if(This->nsdoc) { @@ -1982,6 +1984,7 @@ static HTMLDocumentNode *alloc_doc_node(HTMLDocumentObj *doc_obj, HTMLWindow *wi list_init(&doc->bindings); list_init(&doc->selection_list); list_init(&doc->range_list); + list_init(&doc->plugin_hosts); return doc; } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index c27a068..269962f 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -618,6 +618,7 @@ struct HTMLDocumentNode { struct list bindings; struct list selection_list; struct list range_list; + struct list plugin_hosts; }; #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl) diff --git a/dlls/mshtml/npplugin.c b/dlls/mshtml/npplugin.c index 60f2125..a1c1c47 100644 --- a/dlls/mshtml/npplugin.c +++ b/dlls/mshtml/npplugin.c @@ -272,7 +272,7 @@ static NPError CDECL NPP_New(NPMIMEType pluginType, NPP instance, UINT16 mode, I PluginHost *host; HRESULT hres; - hres = create_plugin_host(obj, &host); + hres = create_plugin_host(window->doc, obj, &host); nsIDOMElement_Release(nselem); IUnknown_Release(obj); if(SUCCEEDED(hres)) diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c index e7f39d8..27404f6 100644 --- a/dlls/mshtml/pluginhost.c +++ b/dlls/mshtml/pluginhost.c @@ -160,6 +160,7 @@ static ULONG WINAPI PHClientSite_Release(IOleClientSite *iface) TRACE("(%p) ref=%d\n", This, ref); if(!ref) { + list_remove(&This->entry); if(This->plugin_unk) IUnknown_Release(This->plugin_unk); heap_free(This); @@ -731,7 +732,18 @@ static const IServiceProviderVtbl ServiceProviderVtbl = { PHServiceProvider_QueryService }; -HRESULT create_plugin_host(IUnknown *unk, PluginHost **ret) +void detach_plugin_hosts(HTMLDocumentNode *doc) +{ + PluginHost *iter; + + while(!list_empty(&doc->plugin_hosts)) { + iter = LIST_ENTRY(list_head(&doc->plugin_hosts), PluginHost, entry); + list_remove(&iter->entry); + iter->doc = NULL; + } +} + +HRESULT create_plugin_host(HTMLDocumentNode *doc, IUnknown *unk, PluginHost **ret) { PluginHost *host; @@ -753,6 +765,9 @@ HRESULT create_plugin_host(IUnknown *unk, PluginHost **ret) IUnknown_AddRef(unk); host->plugin_unk = unk; + host->doc = doc; + list_add_tail(&doc->plugin_hosts, &host->entry); + *ret = host; return S_OK; } diff --git a/dlls/mshtml/pluginhost.h b/dlls/mshtml/pluginhost.h index 2b66696..ab61523 100644 --- a/dlls/mshtml/pluginhost.h +++ b/dlls/mshtml/pluginhost.h @@ -32,7 +32,11 @@ typedef struct { IUnknown *plugin_unk; HWND hwnd; + + HTMLDocumentNode *doc; + struct list entry; } PluginHost; -HRESULT create_plugin_host(IUnknown*,PluginHost**); +HRESULT create_plugin_host(HTMLDocumentNode*,IUnknown*,PluginHost**); void update_plugin_window(PluginHost*,HWND,const RECT*); +void detach_plugin_hosts(HTMLDocumentNode*);
participants (1)
-
Alexandre Julliard