Subj : Re: automatic variable that holds JSAtom* in JS_DefineFunction() is not GC protected. To : netscape.public.mozilla.jseng From : "itaj sherman" Date : Thu Mar 13 2003 12:28 pm i think the JS_AddNamedRoot( rCx, &aRootObject ) always happened because i asserted the value of aRootObject just the line before. i changed to alway do JS_AddNamedRoot() anyway, and asserting the return value - it's always JS_TRUE. the inner block scope aGuardX2 is there because i once tried to add a lock that allows only one thread to compile at a time would stop the bug. in order to do that i had to suspend-resume the GC request while waiting on sJSCompileLock to avoid AB-BA deadlock. in fact this only made the bug occur much faster (100 times faster or so), so i left it there. actually the lock on sJSCompileLock is not needed anymore, so i disabled that line (you can do that too), but if i don't leave the suspend-resume (and then aGuardX2 needed too) the bug will not happen - or will in only very long time, i ran this program this way for 2 days (if i remember right) once and it didn't crash. .