mshtml: Share nsobject reference with nsnode.

This commit is contained in:
Jacek Caban 2012-06-27 10:58:23 +02:00 committed by Alexandre Julliard
parent f2b3220854
commit 7a8f0994df
1 changed files with 7 additions and 9 deletions

View File

@ -17,6 +17,7 @@
*/ */
#include <stdarg.h> #include <stdarg.h>
#include <assert.h>
#define COBJMACROS #define COBJMACROS
@ -571,8 +572,6 @@ static void HTMLObjectElement_destructor(HTMLDOMNode *iface)
if(This->plugin_container.plugin_host) if(This->plugin_container.plugin_host)
detach_plugin_host(This->plugin_container.plugin_host); detach_plugin_host(This->plugin_container.plugin_host);
if(This->nsobject)
nsIDOMHTMLObjectElement_Release(This->nsobject);
HTMLElement_destructor(&This->plugin_container.element.node); HTMLElement_destructor(&This->plugin_container.element.node);
} }
@ -646,15 +645,14 @@ HRESULT HTMLObjectElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nsele
ret->IHTMLObjectElement2_iface.lpVtbl = &HTMLObjectElement2Vtbl; ret->IHTMLObjectElement2_iface.lpVtbl = &HTMLObjectElement2Vtbl;
ret->plugin_container.element.node.vtbl = &HTMLObjectElementImplVtbl; ret->plugin_container.element.node.vtbl = &HTMLObjectElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDOMHTMLObjectElement iface: %08x\n", nsres);
heap_free(ret);
return E_FAIL;
}
HTMLElement_Init(&ret->plugin_container.element, doc, nselem, &HTMLObjectElement_dispex); HTMLElement_Init(&ret->plugin_container.element, doc, nselem, &HTMLObjectElement_dispex);
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLObjectElement, (void**)&ret->nsobject);
/* Share nsobject reference with nsnode */
assert(nsres == NS_OK && (nsIDOMNode*)ret->nsobject == ret->plugin_container.element.node.nsnode);
nsIDOMNode_Release(ret->plugin_container.element.node.nsnode);
*elem = &ret->plugin_container.element; *elem = &ret->plugin_container.element;
return S_OK; return S_OK;
} }