From a916bc768d8bb281e2ad67e58ba9839b36e850b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Fri, 4 Aug 2023 17:30:14 +0300 Subject: [PATCH] mshtml: Use unlink and destructor in the vtbl for Console. 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 f6cf0755a74..71beb3cc41c 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -2609,10 +2609,8 @@ static ULONG WINAPI console_Release(IWineMSHTMLConsole *iface) TRACE("(%p) ref=%ld\n", console, ref); - if(!ref) { + if(!ref) release_dispex(&console->dispex); - free(console); - } return ref; } @@ -2789,13 +2787,28 @@ static const IWineMSHTMLConsoleVtbl WineMSHTMLConsoleVtbl = { console_warn, }; +static inline struct console *console_from_DispatchEx(DispatchEx *iface) +{ + return CONTAINING_RECORD(iface, struct console, dispex); +} + +static void console_destructor(DispatchEx *dispex) +{ + struct console *console = console_from_DispatchEx(dispex); + free(console); +} + +static const dispex_static_data_vtbl_t console_dispex_vtbl = { + console_destructor, +}; + static const tid_t console_iface_tids[] = { IWineMSHTMLConsole_tid, 0 }; static dispex_static_data_t console_dispex = { L"Console", - NULL, + &console_dispex_vtbl, IWineMSHTMLConsole_tid, console_iface_tids };