Module: wine Branch: master Commit: a916bc768d8bb281e2ad67e58ba9839b36e850b4 URL: https://gitlab.winehq.org/wine/wine/-/commit/a916bc768d8bb281e2ad67e58ba9839...
Author: Gabriel Ivăncescu gabrielopcode@gmail.com Date: Fri Aug 4 17:30:14 2023 +0300
mshtml: Use unlink and destructor in the vtbl for Console.
Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com
---
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 };