mshtml: Pass HTMLDOMNode pointer to its destructor.

This commit is contained in:
Jacek Caban 2007-10-04 02:07:59 +02:00 committed by Alexandre Julliard
parent 829cafc651
commit 6270a46ded
3 changed files with 18 additions and 17 deletions

View File

@ -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_NODE_THIS(node) ((HTMLElement *) node)
#define HTMLELEM_NODE_THIS(iface) DEFINE_THIS2(HTMLElement, node, iface)
static HRESULT WINAPI HTMLElement_QueryInterface(IHTMLElement *iface,
REFIID riid, void **ppv)
@ -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);
}
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
static const IHTMLElementVtbl HTMLElementVtbl = {
@ -1278,6 +1265,19 @@ HRESULT HTMLElement_QI(HTMLElement *This, REFIID riid, void **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)
{
nsIDOMHTMLElement *nselem;

View File

@ -395,7 +395,7 @@ void release_nodes(HTMLDocument *This)
next = iter->next;
nsIDOMNode_Release(iter->nsnode);
if(iter->destructor)
iter->destructor(iter->impl.unk);
iter->destructor(iter);
else
mshtml_free(iter);
}

View File

@ -253,7 +253,7 @@ struct BSCallback {
struct HTMLDOMNode {
const IHTMLDOMNodeVtbl *lpHTMLDOMNodeVtbl;
void (*destructor)(IUnknown*);
void (*destructor)(HTMLDOMNode*);
union {
IUnknown *unk;
@ -335,7 +335,8 @@ typedef struct {
#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 HTMLLoadOptions_Create(IUnknown*,REFIID,void**);