Fix for bug 402535 (Cycle collection crashes with Leak Monitor extension installed). Pending-r=sicking, sr=jst, a=dsicore.

This commit is contained in:
peterv@propagandism.org 2007-11-05 11:43:08 -08:00
parent f25d1acc8d
commit 7d616bf099

View File

@ -454,15 +454,19 @@ void XPCJSRuntime::UnsetContextGlobals()
if(nsXPConnect::GetXPConnect()->GetRequestDepth(acx) == 0) if(nsXPConnect::GetXPConnect()->GetRequestDepth(acx) == 0)
{ {
JS_ClearNewbornRoots(acx); JS_ClearNewbornRoots(acx);
JSDHashEntryHdr* entry = if(acx->globalObject)
JS_DHashTableOperate(&mClearedGlobalObjects, acx, JS_DHASH_ADD);
ClearedGlobalObject* clearedGlobal =
reinterpret_cast<ClearedGlobalObject*>(entry);
if(clearedGlobal)
{ {
clearedGlobal->mContext = acx; JSDHashEntryHdr* entry =
clearedGlobal->mGlobalObject = acx->globalObject; JS_DHashTableOperate(&mClearedGlobalObjects, acx,
acx->globalObject = nsnull; JS_DHASH_ADD);
ClearedGlobalObject* clearedGlobal =
reinterpret_cast<ClearedGlobalObject*>(entry);
if(clearedGlobal)
{
clearedGlobal->mContext = acx;
clearedGlobal->mGlobalObject = acx->globalObject;
acx->globalObject = nsnull;
}
} }
} }
} }