mshtml: Properly release DispatchEx data.

This commit is contained in:
Jacek Caban 2009-08-31 20:47:55 +02:00 committed by Alexandre Julliard
parent 012004bcf9
commit b42243e8e7
11 changed files with 45 additions and 2 deletions

View File

@ -946,9 +946,40 @@ BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
return TRUE; 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) void init_dispex(DispatchEx *dispex, IUnknown *outer, dispex_static_data_t *data)
{ {
dispex->lpIDispatchExVtbl = &DispatchExVtbl; dispex->lpIDispatchExVtbl = &DispatchExVtbl;
dispex->outer = outer; dispex->outer = outer;
dispex->data = data; dispex->data = data;
dispex->dynamic_data = NULL;
} }

View File

@ -90,6 +90,7 @@ static ULONG WINAPI HTMLCurrentStyle_Release(IHTMLCurrentStyle *iface)
if(!ref) { if(!ref) {
if(This->nsstyle) if(This->nsstyle)
nsIDOMCSSStyleDeclaration_Release(This->nsstyle); nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
release_dispex(&This->dispex);
heap_free(This); heap_free(This);
} }

View File

@ -215,6 +215,7 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface)
detach_selection(This); detach_selection(This);
detach_ranges(This); detach_ranges(This);
release_nodes(This); release_nodes(This);
release_dispex(&This->dispex);
ConnectionPointContainer_Destroy(&This->cp_container); ConnectionPointContainer_Destroy(&This->cp_container);

View File

@ -132,6 +132,7 @@ static ULONG WINAPI HTMLElementCollection_Release(IHTMLElementCollection *iface)
if(!ref) { if(!ref) {
IUnknown_Release(This->ref_unk); IUnknown_Release(This->ref_unk);
release_dispex(&This->dispex);
heap_free(This->elems); heap_free(This->elems);
heap_free(This); heap_free(This);
} }

View File

@ -176,8 +176,10 @@ static ULONG WINAPI HTMLEventObj_Release(IHTMLEventObj *iface)
TRACE("(%p) ref=%d\n", This, ref); TRACE("(%p) ref=%d\n", This, ref);
if(!ref) if(!ref) {
release_dispex(&This->dispex);
heap_free(This); heap_free(This);
}
return ref; return ref;
} }

View File

@ -82,6 +82,7 @@ static ULONG WINAPI HTMLLocation_Release(IHTMLLocation *iface)
if(!ref) { if(!ref) {
if(This->doc && This->doc->location == This) if(This->doc && This->doc->location == This)
This->doc->location = NULL; This->doc->location = NULL;
release_dispex(&This->dispex);
heap_free(This); heap_free(This);
} }

View File

@ -308,6 +308,7 @@ static ULONG WINAPI HTMLDOMNode_Release(IHTMLDOMNode *iface)
if(!ref) { if(!ref) {
This->vtbl->destructor(This); This->vtbl->destructor(This);
release_dispex(&This->dispex);
heap_free(This); heap_free(This);
} }

View File

@ -554,6 +554,7 @@ static ULONG WINAPI HTMLStyle_Release(IHTMLStyle *iface)
if(!ref) { if(!ref) {
if(This->nsstyle) if(This->nsstyle)
nsIDOMCSSStyleDeclaration_Release(This->nsstyle); nsIDOMCSSStyleDeclaration_Release(This->nsstyle);
release_dispex(&This->dispex);
heap_free(This); heap_free(This);
} }

View File

@ -93,6 +93,7 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
if(!ref) { if(!ref) {
list_remove(&This->entry); list_remove(&This->entry);
release_dispex(&This->dispex);
heap_free(This); heap_free(This);
} }

View File

@ -149,6 +149,7 @@ typedef struct {
} DispatchEx; } DispatchEx;
void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*); void init_dispex(DispatchEx*,IUnknown*,dispex_static_data_t*);
void release_dispex(DispatchEx*);
BOOL dispex_query_interface(DispatchEx*,REFIID,void**); BOOL dispex_query_interface(DispatchEx*,REFIID,void**);
HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**); HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**);

View File

@ -84,8 +84,10 @@ static ULONG WINAPI OmNavigator_Release(IOmNavigator *iface)
TRACE("(%p) ref=%d\n", This, ref); TRACE("(%p) ref=%d\n", This, ref);
if(!ref) if(!ref) {
release_dispex(&This->dispex);
heap_free(This); heap_free(This);
}
return ref; return ref;
} }