Commit b962fff2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Associate PluginHost with containing HTMLDocumentDode.

parent d9dcafab
......@@ -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;
}
......
......@@ -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)
......
......@@ -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))
......
......@@ -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;
}
......@@ -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*);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment