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

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2023-08-03 15:56:13 +03:00 committed by Alexandre Julliard
parent 679617179c
commit 530c68d829

View file

@ -1022,12 +1022,8 @@ static ULONG WINAPI HTMLMimeTypesCollection_Release(IHTMLMimeTypesCollection *if
TRACE("(%p) ref=%ld\n", This, ref); TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) { if(!ref)
if(This->navigator)
This->navigator->mime_types = NULL;
release_dispex(&This->dispex); release_dispex(&This->dispex);
free(This);
}
return ref; return ref;
} }
@ -1084,13 +1080,38 @@ static const IHTMLMimeTypesCollectionVtbl HTMLMimeTypesCollectionVtbl = {
HTMLMimeTypesCollection_get_length HTMLMimeTypesCollection_get_length
}; };
static inline HTMLMimeTypesCollection *HTMLMimeTypesCollection_from_DispatchEx(DispatchEx *iface)
{
return CONTAINING_RECORD(iface, HTMLMimeTypesCollection, dispex);
}
static void HTMLMimeTypesCollection_unlink(DispatchEx *dispex)
{
HTMLMimeTypesCollection *This = HTMLMimeTypesCollection_from_DispatchEx(dispex);
if(This->navigator) {
This->navigator->mime_types = NULL;
This->navigator = NULL;
}
}
static void HTMLMimeTypesCollection_destructor(DispatchEx *dispex)
{
HTMLMimeTypesCollection *This = HTMLMimeTypesCollection_from_DispatchEx(dispex);
free(This);
}
static const dispex_static_data_vtbl_t HTMLMimeTypesCollection_dispex_vtbl = {
HTMLMimeTypesCollection_destructor,
HTMLMimeTypesCollection_unlink
};
static const tid_t HTMLMimeTypesCollection_iface_tids[] = { static const tid_t HTMLMimeTypesCollection_iface_tids[] = {
IHTMLMimeTypesCollection_tid, IHTMLMimeTypesCollection_tid,
0 0
}; };
static dispex_static_data_t HTMLMimeTypesCollection_dispex = { static dispex_static_data_t HTMLMimeTypesCollection_dispex = {
L"MimeTypeArray", L"MimeTypeArray",
NULL, &HTMLMimeTypesCollection_dispex_vtbl,
IHTMLMimeTypesCollection_tid, IHTMLMimeTypesCollection_tid,
HTMLMimeTypesCollection_iface_tids HTMLMimeTypesCollection_iface_tids
}; };