Bug 622691 followup: invert statement order in AutoUnlockDefaultCompartment to get update inside lock, r=gal, a=blocking
authorDavid Mandelin <dmandelin@mozilla.com>
Thu, 06 Jan 2011 11:30:15 -0800
changeset 60226 aa2cb417ef96503b312652e7e8d262ebe8219c39
parent 60225 7558dc118df513a41cbed1da33027eea0d09a87f
child 60227 11362bbb1bfa028bf3a83db7b9555fb949163183
push id17888
push userdmandelin@mozilla.com
push dateSat, 08 Jan 2011 00:27:32 +0000
treeherdermozilla-central@aa2cb417ef96 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgal, blocking
bugs622691
milestone2.0b9pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 622691 followup: invert statement order in AutoUnlockDefaultCompartment to get update inside lock, r=gal, a=blocking
js/src/jscntxt.h
--- a/js/src/jscntxt.h
+++ b/js/src/jscntxt.h
@@ -2672,26 +2672,26 @@ class AutoLockDefaultCompartment {
     }
 };
 
 class AutoUnlockDefaultCompartment {
   private:
       JSContext *cx;
   public:
     AutoUnlockDefaultCompartment(JSContext *cx) : cx(cx) {
-        JS_UNLOCK(cx, &cx->runtime->atomState.lock);
 #ifdef JS_THREADSAFE
         cx->runtime->defaultCompartmentIsLocked = false;
 #endif
+        JS_UNLOCK(cx, &cx->runtime->atomState.lock);
     }
     ~AutoUnlockDefaultCompartment() {
+        JS_LOCK(cx, &cx->runtime->atomState.lock);
 #ifdef JS_THREADSAFE
         cx->runtime->defaultCompartmentIsLocked = true;
 #endif
-        JS_LOCK(cx, &cx->runtime->atomState.lock);
     }
 };
 
 class AutoKeepAtoms {
     JSRuntime *rt;
   public:
     explicit AutoKeepAtoms(JSRuntime *rt) : rt(rt) { JS_KEEP_ATOMS(rt); }
     ~AutoKeepAtoms() { JS_UNKEEP_ATOMS(rt); }