mshtml: Pass event target as EventTarget to release_event_target.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-02-13 21:11:50 +01:00 committed by Alexandre Julliard
parent 57239e7822
commit bc02ba80b9
4 changed files with 16 additions and 13 deletions

View File

@ -1642,20 +1642,25 @@ HRESULT doc_init_events(HTMLDocumentNode *doc)
return S_OK; return S_OK;
} }
void release_event_target(event_target_t *event_target) void release_event_target(EventTarget *event_target)
{ {
int i; int i;
unsigned int j; unsigned int j;
if(!event_target->ptr)
return;
for(i=0; i < EVENTID_LAST; i++) { for(i=0; i < EVENTID_LAST; i++) {
if(event_target->event_table[i]) { if(event_target->ptr->event_table[i]) {
if(event_target->event_table[i]->handler_prop) if(event_target->ptr->event_table[i]->handler_prop)
IDispatch_Release(event_target->event_table[i]->handler_prop); IDispatch_Release(event_target->ptr->event_table[i]->handler_prop);
for(j=0; j < event_target->event_table[i]->handler_cnt; j++) for(j=0; j < event_target->ptr->event_table[i]->handler_cnt; j++)
if(event_target->event_table[i]->handlers[j]) if(event_target->ptr->event_table[i]->handlers[j])
IDispatch_Release(event_target->event_table[i]->handlers[j]); IDispatch_Release(event_target->ptr->event_table[i]->handlers[j]);
heap_free(event_target->ptr->event_table[i]->handlers);
heap_free(event_target->ptr->event_table[i]);
} }
} }
heap_free(event_target); heap_free(event_target->ptr);
} }

View File

@ -55,7 +55,7 @@ typedef enum {
eventid_t str_to_eid(LPCWSTR) DECLSPEC_HIDDEN; eventid_t str_to_eid(LPCWSTR) DECLSPEC_HIDDEN;
void check_event_attr(HTMLDocumentNode*,nsIDOMHTMLElement*) DECLSPEC_HIDDEN; void check_event_attr(HTMLDocumentNode*,nsIDOMHTMLElement*) DECLSPEC_HIDDEN;
void release_event_target(event_target_t*) DECLSPEC_HIDDEN; void release_event_target(EventTarget*) DECLSPEC_HIDDEN;
void fire_event(HTMLDocumentNode*,eventid_t,BOOL,HTMLDOMNode*,nsIDOMEvent*,IDispatch*) DECLSPEC_HIDDEN; void fire_event(HTMLDocumentNode*,eventid_t,BOOL,HTMLDOMNode*,nsIDOMEvent*,IDispatch*) DECLSPEC_HIDDEN;
HRESULT set_event_handler(EventTarget*,eventid_t,VARIANT*) DECLSPEC_HIDDEN; HRESULT set_event_handler(EventTarget*,eventid_t,VARIANT*) DECLSPEC_HIDDEN;
HRESULT get_event_handler(EventTarget*,eventid_t,VARIANT*) DECLSPEC_HIDDEN; HRESULT get_event_handler(EventTarget*,eventid_t,VARIANT*) DECLSPEC_HIDDEN;

View File

@ -1185,12 +1185,11 @@ HRESULT HTMLDOMNode_QI(HTMLDOMNode *This, REFIID riid, void **ppv)
void HTMLDOMNode_destructor(HTMLDOMNode *This) void HTMLDOMNode_destructor(HTMLDOMNode *This)
{ {
release_event_target(&This->event_target);
if(This->nsnode) if(This->nsnode)
nsIDOMNode_Release(This->nsnode); nsIDOMNode_Release(This->nsnode);
if(This->doc && &This->doc->node != This) if(This->doc && &This->doc->node != This)
htmldoc_release(&This->doc->basedoc); htmldoc_release(&This->doc->basedoc);
if(This->event_target.ptr)
release_event_target(This->event_target.ptr);
} }
static HRESULT HTMLDOMNode_clone(HTMLDOMNode *This, nsIDOMNode *nsnode, HTMLDOMNode **ret) static HRESULT HTMLDOMNode_clone(HTMLDOMNode *This, nsIDOMNode *nsnode, HTMLDOMNode **ret)

View File

@ -253,8 +253,7 @@ static void release_inner_window(HTMLInnerWindow *This)
htmldoc_release(&This->doc->basedoc); htmldoc_release(&This->doc->basedoc);
} }
if(This->event_target.ptr) release_event_target(&This->event_target);
release_event_target(This->event_target.ptr);
release_dispex(&This->event_target.dispex); release_dispex(&This->event_target.dispex);
for(i=0; i < This->global_prop_cnt; i++) for(i=0; i < This->global_prop_cnt; i++)