Commit b42243e8 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Properly release DispatchEx data.

parent 012004bc
......@@ -946,9 +946,40 @@ BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
return TRUE;
}
void release_dispex(DispatchEx *This)
{
dynamic_prop_t *prop;
if(!This->dynamic_data)
return;
for(prop = This->dynamic_data->props; prop < This->dynamic_data->props + This->dynamic_data->prop_cnt; prop++) {
VariantClear(&prop->var);
heap_free(prop->name);
}
heap_free(This->dynamic_data->props);
if(This->dynamic_data->func_disps) {
unsigned i;
for(i=0; i < This->data->data->func_disp_cnt; i++) {
if(This->dynamic_data->func_disps[i]) {
release_dispex(&This->dynamic_data->func_disps[i]->dispex);
heap_free(This->dynamic_data->func_disps[i]);
}
}
heap_free(This->dynamic_data->func_disps);
}
heap_free(This->dynamic_data);
}
void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data)
{
dispex->lpIDispatchExVtbl = &DispatchExVtbl;
dispex->outer = outer;
dispex->data = data;
dispex->dynamic_data = NULL;
}
......@@ -90,6 +90,7 @@ static ULONG WINAPI HTMLCurrentStyle_Release(IHTMLCurrentStyle *iface)
if(!ref) {
if(This->nsstyle)
nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
release_dispex(&This->dispex);
heap_free(This);
}
......
......@@ -215,6 +215,7 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
detach_selection(This);
detach_ranges(This);
release_nodes(This);
release_dispex(&This->dispex);
ConnectionPointContainer_Destroy(&This->cp_container);
......
......@@ -132,6 +132,7 @@ static ULONG WINAPI HTMLElementCollection_Release(IHTMLElementCollection *iface)
if(!ref) {
IUnknown_Release(This->ref_unk);
release_dispex(&This->dispex);
heap_free(This->elems);
heap_free(This);
}
......
......@@ -176,8 +176,10 @@ static ULONG WINAPI HTMLEventObj_Release(IHTMLEventObj *iface)
TRACE("(%p) ref=%d\n", This, ref);
if(!ref)
if(!ref) {
release_dispex(&This->dispex);
heap_free(This);
}
return ref;
}
......
......@@ -82,6 +82,7 @@ static ULONG WINAPI HTMLLocation_Release(IHTMLLocation *iface)
if(!ref) {
if(This->doc && This->doc->location == This)
This->doc->location = NULL;
release_dispex(&This->dispex);
heap_free(This);
}
......
......@@ -308,6 +308,7 @@ static ULONG WINAPI HTMLDOMNode_Release(IHTMLDOMNode *iface)
if(!ref) {
This->vtbl->destructor(This);
release_dispex(&This->dispex);
heap_free(This);
}
......
......@@ -554,6 +554,7 @@ static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
if(!ref) {
if(This->nsstyle)
nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
release_dispex(&This->dispex);
heap_free(This);
}
......
......@@ -93,6 +93,7 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
if(!ref) {
list_remove(&This->entry);
release_dispex(&This->dispex);
heap_free(This);
}
......
......@@ -149,6 +149,7 @@ typedef struct {
} DispatchEx;
void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
void release_dispex(DispatchEx*);
BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);
......
......@@ -84,8 +84,10 @@ static ULONG WINAPI OmNavigator_Release(IOmNavigator *iface)
TRACE("(%p) ref=%d\n", This, ref);
if(!ref)
if(!ref) {
release_dispex(&This->dispex);
heap_free(This);
}
return ref;
}
......
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