Commit 6270a46d authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Pass HTMLDOMNode pointer to its destructor.

parent 829cafc6
...@@ -58,7 +58,7 @@ static void elem_vector_add(elem_vector *buf, HTMLElement *elem) ...@@ -58,7 +58,7 @@ static void elem_vector_add(elem_vector *buf, HTMLElement *elem)
#define HTMLELEM_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement, iface) #define HTMLELEM_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement, iface)
#define HTMLELEM_NODE_THIS(node) ((HTMLElement *) node) #define HTMLELEM_NODE_THIS(iface) DEFINE_THIS2(HTMLElement, node, iface)
static HRESULT WINAPI HTMLElement_QueryInterface(IHTMLElement *iface, static HRESULT WINAPI HTMLElement_QueryInterface(IHTMLElement *iface,
REFIID riid, void **ppv) REFIID riid, void **ppv)
...@@ -1140,19 +1140,6 @@ static HRESULT WINAPI HTMLElement_get_all(IHTMLElement *iface, IDispatch **p) ...@@ -1140,19 +1140,6 @@ static HRESULT WINAPI HTMLElement_get_all(IHTMLElement *iface, IDispatch **p)
return HTMLElementCollection_Create((IUnknown*)HTMLELEM(This), buf.buf, buf.len, p); return HTMLElementCollection_Create((IUnknown*)HTMLELEM(This), buf.buf, buf.len, p);
} }
static void HTMLElement_destructor(IUnknown *iface)
{
HTMLElement *This = HTMLELEM_THIS(iface);
if(This->destructor)
This->destructor(This->impl);
if(This->nselem)
nsIDOMHTMLElement_Release(This->nselem);
mshtml_free(This);
}
#undef HTMLELEM_THIS #undef HTMLELEM_THIS
static const IHTMLElementVtbl HTMLElementVtbl = { static const IHTMLElementVtbl HTMLElementVtbl = {
...@@ -1278,6 +1265,19 @@ HRESULT HTMLElement_QI(HTMLElement *This, REFIID riid, void **ppv) ...@@ -1278,6 +1265,19 @@ HRESULT HTMLElement_QI(HTMLElement *This, REFIID riid, void **ppv)
return HTMLDOMNode_QI(&This->node, riid, ppv); return HTMLDOMNode_QI(&This->node, riid, ppv);
} }
static void HTMLElement_destructor(HTMLDOMNode *iface)
{
HTMLElement *This = HTMLELEM_NODE_THIS(iface);
if(This->destructor)
This->destructor(This->impl);
if(This->nselem)
nsIDOMHTMLElement_Release(This->nselem);
mshtml_free(This);
}
HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode) HTMLElement *HTMLElement_Create(nsIDOMNode *nsnode)
{ {
nsIDOMHTMLElement *nselem; nsIDOMHTMLElement *nselem;
......
...@@ -395,7 +395,7 @@ void release_nodes(HTMLDocument *This) ...@@ -395,7 +395,7 @@ void release_nodes(HTMLDocument *This)
next = iter->next; next = iter->next;
nsIDOMNode_Release(iter->nsnode); nsIDOMNode_Release(iter->nsnode);
if(iter->destructor) if(iter->destructor)
iter->destructor(iter->impl.unk); iter->destructor(iter);
else else
mshtml_free(iter); mshtml_free(iter);
} }
......
...@@ -253,7 +253,7 @@ struct BSCallback { ...@@ -253,7 +253,7 @@ struct BSCallback {
struct HTMLDOMNode { struct HTMLDOMNode {
const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl; const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
void (*destructor)(IUnknown*); void (*destructor)(HTMLDOMNode*);
union { union {
IUnknown *unk; IUnknown *unk;
...@@ -335,7 +335,8 @@ typedef struct { ...@@ -335,7 +335,8 @@ typedef struct {
#define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl) #define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl))) #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc)))
#define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface)
HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**); HRESULT HTMLDocument_Create(IUnknown*,REFIID,void**);
HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**); HRESULT HTMLLoadOptions_Create(IUnknown*,REFIID,void**);
......
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