mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix for bug 443483 (Closed windows need two cycle collections to be collected). r=bent, sr=jst, a=jst.
This commit is contained in:
parent
567ba71782
commit
d692e5fef1
@ -589,6 +589,17 @@ nsTimeout::~nsTimeout()
|
||||
MOZ_COUNT_DTOR(nsTimeout);
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsTimeout)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NATIVE_0(nsTimeout)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(nsTimeout)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mWindow,
|
||||
nsIScriptGlobalObject)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPrincipal)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mScriptHandler)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsTimeout, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsTimeout, Release)
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//*** nsGlobalWindow: Object Management
|
||||
@ -1011,6 +1022,13 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsGlobalWindow)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOpenerScriptPrincipal)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mListenerManager)
|
||||
|
||||
for (nsTimeout* timeout = tmp->FirstTimeout();
|
||||
tmp->IsTimeout(timeout);
|
||||
timeout = timeout->Next()) {
|
||||
cb.NoteNativeChild(timeout, &NS_CYCLE_COLLECTION_NAME(nsTimeout));
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSessionStorage)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mApplicationCache)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDocumentPrincipal)
|
||||
|
@ -149,6 +149,8 @@ struct nsTimeout : PRCList
|
||||
nsTimeout();
|
||||
~nsTimeout();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsTimeout)
|
||||
|
||||
nsrefcnt Release();
|
||||
nsrefcnt AddRef();
|
||||
|
||||
@ -199,7 +201,7 @@ struct nsTimeout : PRCList
|
||||
|
||||
private:
|
||||
// reference count for shared usage
|
||||
PRInt32 mRefCnt;
|
||||
nsAutoRefCnt mRefCnt;
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
|
@ -91,7 +91,7 @@ NS_CYCLE_COLLECTION_CLASSNAME(nsXPCWrappedJS)::Traverse
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_BEGIN(nsXPCWrappedJS)
|
||||
if(tmp->mRoot && !tmp->mRoot->HasWeakReferences() && tmp->IsValid())
|
||||
if(tmp->IsValid())
|
||||
{
|
||||
XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
|
||||
if(rt)
|
||||
@ -116,10 +116,7 @@ NS_IMPL_CYCLE_COLLECTION_ROOT_BEGIN(nsXPCWrappedJS)
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXPCWrappedJS)
|
||||
if(tmp->mRoot && !tmp->mRoot->HasWeakReferences())
|
||||
{
|
||||
tmp->Unlink();
|
||||
}
|
||||
tmp->Unlink();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -454,9 +451,6 @@ nsXPCWrappedJS::~nsXPCWrappedJS()
|
||||
|
||||
if(mRoot == this)
|
||||
{
|
||||
// Let the nsWeakReference object (if present) know of our demise.
|
||||
ClearWeakReferences();
|
||||
|
||||
// Remove this root wrapper from the map
|
||||
XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
|
||||
JSObject2WrappedJSMap* map = rt->GetWrappedJSMap();
|
||||
@ -472,7 +466,11 @@ nsXPCWrappedJS::~nsXPCWrappedJS()
|
||||
void
|
||||
nsXPCWrappedJS::Unlink()
|
||||
{
|
||||
if(mRoot != this && mRoot)
|
||||
if(mRoot == this)
|
||||
{
|
||||
ClearWeakReferences();
|
||||
}
|
||||
else if(mRoot)
|
||||
{
|
||||
// unlink this wrapper
|
||||
nsXPCWrappedJS* cur = mRoot;
|
||||
|
Loading…
Reference in New Issue
Block a user