mshtml: Unlink variants using a helper function.

And move the clear to the destructor.

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 ff5db66c43
commit 392a15cdc9
4 changed files with 26 additions and 4 deletions

View file

@ -2030,8 +2030,8 @@ void dispex_unlink(DispatchEx *This)
return;
for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) {
VariantClear(&prop->var);
prop->flags |= DYNPROP_DELETED;
unlink_variant(&prop->var);
}
if(This->dynamic_data->func_disps) {

View file

@ -2462,7 +2462,14 @@ static void DOMCustomEvent_unlink(DispatchEx *dispex)
{
DOMCustomEvent *custom_event = DOMCustomEvent_from_DOMEvent(DOMEvent_from_DispatchEx(dispex));
DOMEvent_unlink(&custom_event->event.dispex);
unlink_variant(&custom_event->detail);
}
static void DOMCustomEvent_destructor(DispatchEx *dispex)
{
DOMCustomEvent *custom_event = DOMCustomEvent_from_DOMEvent(DOMEvent_from_DispatchEx(dispex));
VariantClear(&custom_event->detail);
DOMEvent_destructor(dispex);
}
typedef struct {
@ -2607,7 +2614,14 @@ static void DOMMessageEvent_unlink(DispatchEx *dispex)
{
DOMMessageEvent *message_event = DOMMessageEvent_from_DOMEvent(DOMEvent_from_DispatchEx(dispex));
DOMEvent_unlink(&message_event->event.dispex);
unlink_variant(&message_event->data);
}
static void DOMMessageEvent_destructor(DispatchEx *dispex)
{
DOMMessageEvent *message_event = DOMMessageEvent_from_DOMEvent(DOMEvent_from_DispatchEx(dispex));
VariantClear(&message_event->data);
DOMEvent_destructor(dispex);
}
static void DOMMessageEvent_init_dispex_info(dispex_data_t *info, compat_mode_t compat_mode)
@ -3038,7 +3052,7 @@ static dispex_static_data_t DOMPageTransitionEvent_dispex = {
};
static const dispex_static_data_vtbl_t DOMCustomEvent_dispex_vtbl = {
DOMEvent_destructor,
DOMCustomEvent_destructor,
DOMCustomEvent_unlink
};
@ -3056,7 +3070,7 @@ static dispex_static_data_t DOMCustomEvent_dispex = {
};
static const dispex_static_data_vtbl_t DOMMessageEvent_dispex_vtbl = {
DOMEvent_destructor,
DOMMessageEvent_destructor,
DOMMessageEvent_unlink
};

View file

@ -3777,7 +3777,7 @@ static void HTMLWindow_unlink(DispatchEx *dispex)
IHTMLStorage_Release(local_storage);
}
IHTMLPerformanceTiming_Release(&This->performance_timing->IHTMLPerformanceTiming_iface);
VariantClear(&This->performance);
unlink_variant(&This->performance);
}
static void HTMLWindow_destructor(DispatchEx *dispex)
@ -3785,6 +3785,8 @@ static void HTMLWindow_destructor(DispatchEx *dispex)
HTMLInnerWindow *This = impl_from_DispatchEx(dispex);
unsigned i;
VariantClear(&This->performance);
for(i = 0; i < This->global_prop_cnt; i++)
free(This->global_props[i].name);
free(This->global_props);

View file

@ -1497,6 +1497,12 @@ static inline void unlink_ref(void *p)
}
}
static inline void unlink_variant(VARIANT *v)
{
if(V_VT(v) == VT_DISPATCH || V_VT(v) == VT_UNKNOWN)
unlink_ref(&V_UNKNOWN(v));
}
#ifdef __i386__
extern void *call_thiscall_func;
#endif