Commit 76f622a6 authored by Gabriel Ivăncescu's avatar Gabriel Ivăncescu Committed by Alexandre Julliard

mshtml: Release the event target during node unlink.

The event target can participate in a cycle. Also since release_event_target can now potentially be called multiple times, we have to NULL the rb tree to make it re-entrant safe. Signed-off-by: 's avatarGabriel Ivăncescu <gabrielopcode@gmail.com>
parent a54b322f
......@@ -4552,11 +4552,12 @@ void release_event_target(EventTarget *event_target)
WINE_RB_FOR_EACH_ENTRY_DESTRUCTOR(iter, iter2, &event_target->handler_map, listener_container_t, entry) {
while(!list_empty(&iter->listeners)) {
event_listener_t *listener = LIST_ENTRY(list_head(&iter->listeners), event_listener_t, entry);
list_remove(&listener->entry);
if(listener->function)
IDispatch_Release(listener->function);
list_remove(&listener->entry);
free(listener);
}
free(iter);
}
rb_destroy(&event_target->handler_map, NULL, NULL);
}
......@@ -1443,6 +1443,7 @@ void HTMLDOMNode_unlink(DispatchEx *dispex)
if(This->vtbl->unlink)
This->vtbl->unlink(This);
release_event_target(&This->event_target);
unlink_ref(&This->nsnode);
if(This->doc) {
......@@ -1456,7 +1457,6 @@ void HTMLDOMNode_unlink(DispatchEx *dispex)
void HTMLDOMNode_destructor(DispatchEx *dispex)
{
HTMLDOMNode *This = HTMLDOMNode_from_DispatchEx(dispex);
release_event_target(&This->event_target);
if(This->vtbl->destructor)
This->vtbl->destructor(This);
free(This);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment