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
Родитель f25d1acc8d
Коммит 7d616bf099
1 изменённых файлов: 12 добавлений и 8 удалений

Просмотреть файл

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