Clear the global objects when unrooting them so that we don't leak via cycles
through the global (which is the parent of the proto for various functions on the one hand and references various prototypes on the other hand). Bug 300023, r=shaver, sr=brendan, a=asa git-svn-id: svn://10.0.0.236/trunk@175854 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
39cf7e102d
commit
f2a6cff745
@ -198,8 +198,10 @@ mozJSComponentLoader::mozJSComponentLoader()
|
||||
static PRIntn PR_CALLBACK
|
||||
UnrootGlobals(PLHashEntry *he, PRIntn i, void *arg)
|
||||
{
|
||||
JSRuntime *rt = (JSRuntime *)arg;
|
||||
JS_RemoveRootRT(rt, &he->value);
|
||||
JSContext *cx = (JSContext *)arg;
|
||||
JSObject *global = (JSObject *)he->value;
|
||||
JS_ClearScope(cx, global);
|
||||
JS_RemoveRoot(cx, &he->value);
|
||||
nsCRT::free((char *)he->key);
|
||||
return HT_ENUMERATE_REMOVE;
|
||||
}
|
||||
@ -997,7 +999,7 @@ mozJSComponentLoader::UnloadAll(PRInt32 aWhen)
|
||||
PL_HashTableDestroy(mModules);
|
||||
mModules = nsnull;
|
||||
|
||||
PL_HashTableEnumerateEntries(mGlobals, UnrootGlobals, mRuntime);
|
||||
PL_HashTableEnumerateEntries(mGlobals, UnrootGlobals, mContext);
|
||||
PL_HashTableDestroy(mGlobals);
|
||||
mGlobals = nsnull;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user