зеркало из https://github.com/mozilla/gecko-dev.git
bug 499570 - fixing shutdown leak of not-yet-closed JSNativeEnumerator instances. r=brendan
This commit is contained in:
Родитель
78e3ec6a4d
Коммит
ca47be33c5
|
@ -833,6 +833,10 @@ JS_DestroyRuntime(JSRuntime *rt)
|
|||
{
|
||||
#ifdef DEBUG
|
||||
/* Don't hurt everyone in leaky ol' Mozilla with a fatal JS_ASSERT! */
|
||||
if (rt->nativeEnumerators) {
|
||||
fprintf(stderr,
|
||||
"JS engine warning: leak of native enumerators is detected.\n");
|
||||
}
|
||||
if (!JS_CLIST_IS_EMPTY(&rt->contextList)) {
|
||||
JSContext *cx, *iter = NULL;
|
||||
uintN cxcount = 0;
|
||||
|
|
|
@ -5007,7 +5007,16 @@ js_Enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
|
|||
*statep = JSVAL_ZERO;
|
||||
} else {
|
||||
/* The enumerator has not iterated over all ids. */
|
||||
JS_ASSERT(enum_op == JSENUMERATE_DESTROY);
|
||||
ne->cursor = 0;
|
||||
|
||||
/*
|
||||
* Force on shutdown an extra GC cycle so all native enumerators
|
||||
* on the rt->nativeEnumerators list will be removed when the GC
|
||||
* calls js_TraceNativeEnumerators. See bug 499570.
|
||||
*/
|
||||
if (cx->runtime->state == JSRTS_LANDING)
|
||||
cx->runtime->gcPoke = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче