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

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2023-08-03 15:56:12 +03:00 committed by Alexandre Julliard
parent 9541020f16
commit 159b6d75d0

View file

@ -93,14 +93,8 @@ static ULONG WINAPI HTMLSelectionObject_Release(IHTMLSelectionObject *iface)
TRACE("(%p) ref=%ld\n", This, ref);
if(!ref) {
if(This->nsselection)
nsISelection_Release(This->nsselection);
if(This->doc)
list_remove(&This->entry);
if(!ref)
release_dispex(&This->dispex);
free(This);
}
return ref;
}
@ -329,6 +323,32 @@ static const IHTMLSelectionObject2Vtbl HTMLSelectionObject2Vtbl = {
HTMLSelectionObject2_get_typeDetail
};
static inline HTMLSelectionObject *impl_from_DispatchEx(DispatchEx *iface)
{
return CONTAINING_RECORD(iface, HTMLSelectionObject, dispex);
}
static void HTMLSelectionObject_unlink(DispatchEx *dispex)
{
HTMLSelectionObject *This = impl_from_DispatchEx(dispex);
unlink_ref(&This->nsselection);
if(This->doc) {
This->doc = NULL;
list_remove(&This->entry);
}
}
static void HTMLSelectionObject_destructor(DispatchEx *dispex)
{
HTMLSelectionObject *This = impl_from_DispatchEx(dispex);
free(This);
}
static const dispex_static_data_vtbl_t HTMLSelectionObject_dispex_vtbl = {
HTMLSelectionObject_destructor,
HTMLSelectionObject_unlink
};
static const tid_t HTMLSelectionObject_iface_tids[] = {
IHTMLSelectionObject_tid,
IHTMLSelectionObject2_tid,
@ -336,7 +356,7 @@ static const tid_t HTMLSelectionObject_iface_tids[] = {
};
static dispex_static_data_t HTMLSelectionObject_dispex = {
L"MSSelection",
NULL,
&HTMLSelectionObject_dispex_vtbl,
IHTMLSelectionObject_tid, /* FIXME: We have a test for that, but it doesn't expose IHTMLSelectionObject2 iface. */
HTMLSelectionObject_iface_tids
};