Make sure id array are GC-protected. bug=351973 r=mrbkap sr=brendan

This commit is contained in:
igor.bukanov%gmail.com 2006-09-11 11:17:05 +00:00
Родитель be88ea92d3
Коммит 521fd404df
1 изменённых файлов: 4 добавлений и 0 удалений

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

@ -553,8 +553,10 @@ js_EnterSharpObject(JSContext *cx, JSObject *obj, JSIdArray **idap,
return NULL;
}
map->table = table;
JS_KEEP_ATOMS(cx->runtime);
}
/* From this point the control must flow either through out: or bad:. */
ida = NULL;
if (map->depth == 0) {
he = MarkSharpObjects(cx, obj, &ida);
@ -624,6 +626,7 @@ out:
bad:
/* Clean up the sharpObjectMap table on outermost error. */
if (map->depth == 0) {
JS_UNKEEP_ATOMS(cx->runtime);
map->sharpgen = 0;
JS_HashTableDestroy(map->table);
map->table = NULL;
@ -640,6 +643,7 @@ js_LeaveSharpObject(JSContext *cx, JSIdArray **idap)
map = &cx->sharpObjectMap;
JS_ASSERT(map->depth > 0);
if (--map->depth == 0) {
JS_UNKEEP_ATOMS(cx->runtime);
map->sharpgen = 0;
JS_HashTableDestroy(map->table);
map->table = NULL;