From 94c85bf9bf1df3167bfb435c3695cd566338473c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Thu, 3 Aug 2023 15:56:13 +0300 Subject: [PATCH] mshtml: Use unlink and destructor in the vtbl for HTMLScreen. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/omnavigator.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 8b6a9d76db6..b3dbcb8020b 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -418,10 +418,8 @@ static ULONG WINAPI HTMLScreen_Release(IHTMLScreen *iface) TRACE("(%p) ref=%ld\n", This, ref); - if(!ref) { + if(!ref) release_dispex(&This->dispex); - free(This); - } return ref; } @@ -571,13 +569,28 @@ static const IHTMLScreenVtbl HTMLSreenVtbl = { HTMLScreen_get_fontSmoothingEnabled }; +static inline HTMLScreen *HTMLScreen_from_DispatchEx(DispatchEx *iface) +{ + return CONTAINING_RECORD(iface, HTMLScreen, dispex); +} + +static void HTMLScreen_destructor(DispatchEx *dispex) +{ + HTMLScreen *This = HTMLScreen_from_DispatchEx(dispex); + free(This); +} + +static const dispex_static_data_vtbl_t HTMLScreen_dispex_vtbl = { + HTMLScreen_destructor, +}; + static const tid_t HTMLScreen_iface_tids[] = { IHTMLScreen_tid, 0 }; static dispex_static_data_t HTMLScreen_dispex = { L"Screen", - NULL, + &HTMLScreen_dispex_vtbl, DispHTMLScreen_tid, HTMLScreen_iface_tids };