mshtml: Use unlink and destructor in the vtbl for HTMLElementCollection.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2023-08-04 17:30:15 +03:00 committed by Alexandre Julliard
parent 20b769dcb9
commit 0c99a89b15

View file

@ -252,16 +252,8 @@ static ULONG WINAPI HTMLElementCollection_Release(IHTMLElementCollection *iface)
TRACE("(%p) ref=%ld\n", This, ref); TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) { if(!ref)
unsigned i;
for(i=0; i < This->len; i++)
node_release(&This->elems[i]->node);
free(This->elems);
release_dispex(&This->dispex); release_dispex(&This->dispex);
free(This);
}
return ref; return ref;
} }
@ -550,6 +542,25 @@ static inline HTMLElementCollection *impl_from_DispatchEx(DispatchEx *iface)
return CONTAINING_RECORD(iface, HTMLElementCollection, dispex); return CONTAINING_RECORD(iface, HTMLElementCollection, dispex);
} }
static void HTMLElementCollection_unlink(DispatchEx *dispex)
{
HTMLElementCollection *This = impl_from_DispatchEx(dispex);
unsigned i, len = This->len;
if(len) {
This->len = 0;
for(i = 0; i < len; i++)
node_release(&This->elems[i]->node);
free(This->elems);
}
}
static void HTMLElementCollection_destructor(DispatchEx *dispex)
{
HTMLElementCollection *This = impl_from_DispatchEx(dispex);
free(This);
}
#define DISPID_ELEMCOL_0 MSHTML_DISPID_CUSTOM_MIN #define DISPID_ELEMCOL_0 MSHTML_DISPID_CUSTOM_MIN
static HRESULT HTMLElementCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid) static HRESULT HTMLElementCollection_get_dispid(DispatchEx *dispex, BSTR name, DWORD flags, DISPID *dispid)
@ -622,8 +633,8 @@ static HRESULT HTMLElementCollection_invoke(DispatchEx *dispex, DISPID id, LCID
} }
static const dispex_static_data_vtbl_t HTMLElementColection_dispex_vtbl = { static const dispex_static_data_vtbl_t HTMLElementColection_dispex_vtbl = {
NULL, HTMLElementCollection_destructor,
NULL, HTMLElementCollection_unlink,
NULL, NULL,
HTMLElementCollection_get_dispid, HTMLElementCollection_get_dispid,
HTMLElementCollection_get_name, HTMLElementCollection_get_name,