From adefacfd12bc619266940575a81760087cc41aa2 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 HTMLRect. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Gabriel Ivăncescu --- dlls/mshtml/htmlelem.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index f9ab44ce5fc..653bdd1e6b3 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -582,12 +582,8 @@ static ULONG WINAPI HTMLRect_Release(IHTMLRect *iface) TRACE("(%p) ref=%ld\n", This, ref); - if(!ref) { - if(This->nsrect) - nsIDOMClientRect_Release(This->nsrect); + if(!ref) release_dispex(&This->dispex); - free(This); - } return ref; } @@ -841,19 +837,41 @@ static const IHTMLRect2Vtbl HTMLRect2Vtbl = { HTMLRect2_get_height, }; +static inline HTMLRect *HTMLRect_from_DispatchEx(DispatchEx *iface) +{ + return CONTAINING_RECORD(iface, HTMLRect, dispex); +} + +static void HTMLRect_unlink(DispatchEx *dispex) +{ + HTMLRect *This = HTMLRect_from_DispatchEx(dispex); + unlink_ref(&This->nsrect); +} + +static void HTMLRect_destructor(DispatchEx *dispex) +{ + HTMLRect *This = HTMLRect_from_DispatchEx(dispex); + free(This); +} + void HTMLRect_init_dispex_info(dispex_data_t *info, compat_mode_t mode) { if (mode >= COMPAT_MODE_IE9) dispex_info_add_interface(info, IHTMLRect2_tid, NULL); } +static const dispex_static_data_vtbl_t HTMLRect_dispex_vtbl = { + HTMLRect_destructor, + HTMLRect_unlink +}; + static const tid_t HTMLRect_iface_tids[] = { IHTMLRect_tid, 0 }; static dispex_static_data_t HTMLRect_dispex = { L"ClientRect", - NULL, + &HTMLRect_dispex_vtbl, IHTMLRect_tid, HTMLRect_iface_tids, HTMLRect_init_dispex_info