mshtml: Make node object's dynamic IDispatchEx-based properties cycle collectable.

This commit is contained in:
Jacek Caban 2012-07-19 11:28:54 +02:00 committed by Alexandre Julliard
parent 97ff991f46
commit e9cc7676fa
3 changed files with 37 additions and 0 deletions

View File

@ -1377,6 +1377,38 @@ BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
return TRUE; return TRUE;
} }
void dispex_traverse(DispatchEx *This, nsCycleCollectionTraversalCallback *cb)
{
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++) {
if(V_VT(&prop->var) == VT_DISPATCH)
note_cc_edge((nsISupports*)V_DISPATCH(&prop->var), "dispex_data", cb);
}
/* FIXME: Traverse func_disps */
}
void dispex_unlink(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++) {
if(V_VT(&prop->var) == VT_DISPATCH) {
V_VT(&prop->var) = VT_EMPTY;
IDispatch_Release(V_DISPATCH(&prop->var));
}else {
VariantClear(&prop->var);
}
}
}
void release_dispex(DispatchEx *This) void release_dispex(DispatchEx *This)
{ {
dynamic_prop_t *prop; dynamic_prop_t *prop;

View File

@ -1123,6 +1123,7 @@ static nsresult NSAPI HTMLDOMNode_traverse(void *ccp, void *p, nsCycleCollection
if(This->nsnode) if(This->nsnode)
note_cc_edge((nsISupports*)This->nsnode, "This->nsnode", cb); note_cc_edge((nsISupports*)This->nsnode, "This->nsnode", cb);
dispex_traverse(&This->dispex, cb);
return NS_OK; return NS_OK;
} }
@ -1133,6 +1134,8 @@ static nsresult NSAPI HTMLDOMNode_unlink(void *p)
TRACE("%p\n", This); TRACE("%p\n", This);
dispex_unlink(&This->dispex);
if(This->nsnode) { if(This->nsnode) {
nsIDOMNode *nsnode = This->nsnode; nsIDOMNode *nsnode = This->nsnode;
This->nsnode = NULL; This->nsnode = NULL;

View File

@ -258,6 +258,8 @@ HRESULT dispex_get_dprop_ref(DispatchEx*,const WCHAR*,BOOL,VARIANT**) DECLSPEC_H
HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN; HRESULT get_dispids(tid_t,DWORD*,DISPID**) DECLSPEC_HIDDEN;
HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*) DECLSPEC_HIDDEN; HRESULT remove_prop(DispatchEx*,BSTR,VARIANT_BOOL*) DECLSPEC_HIDDEN;
HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN; HRESULT dispex_get_dynid(DispatchEx*,const WCHAR*,DISPID*) DECLSPEC_HIDDEN;
void dispex_traverse(DispatchEx*,nsCycleCollectionTraversalCallback*) DECLSPEC_HIDDEN;
void dispex_unlink(DispatchEx*) DECLSPEC_HIDDEN;
void release_typelib(void) DECLSPEC_HIDDEN; void release_typelib(void) DECLSPEC_HIDDEN;
HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN; HRESULT get_htmldoc_classinfo(ITypeInfo **typeinfo) DECLSPEC_HIDDEN;