Bug 1177778 - Allow HeapPtr destruction while shutting down the GC r=terrence
authorJon Coppeard <jcoppeard@mozilla.com>
Tue, 30 Jun 2015 10:17:25 +0100
changeset 250680 8551c158f429f871ed9d8dbab0198b192e245f6d
parent 250679 3524973b9630077c314cd6722af7199e5dd48e02
child 250681 3d4f45ad3b8db297e39aaa975dab2626ffda118a
push idunknown
push userunknown
push dateunknown
reviewersterrence
bugs1177778
milestone42.0a1
Bug 1177778 - Allow HeapPtr destruction while shutting down the GC r=terrence
js/src/jit-test/tests/gc/bug-1177778.js
js/src/jsgc.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/gc/bug-1177778.js
@@ -0,0 +1,16 @@
+if (!("setGCCallback" in this))
+    quit();
+
+setGCCallback({
+    action: "majorGC",
+    phases: "both"
+});
+var g = newGlobal();
+var dbg = new Debugger;
+var gw = dbg.addDebuggee(g);
+g.eval("function h() { debugger; }");
+dbg.onDebuggerStatement = function(hframe) {
+    var env = hframe.older.environment;
+};
+g.eval("h();");
+
--- a/js/src/jsgc.cpp
+++ b/js/src/jsgc.cpp
@@ -1328,16 +1328,17 @@ GCRuntime::finish()
 
 #ifdef JS_GC_ZEAL
     /* Free memory associated with GC verification. */
     finishVerifier();
 #endif
 
     /* Delete all remaining zones. */
     if (rt->gcInitialized) {
+        AutoSetThreadIsSweeping threadIsSweeping;
         for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) {
             for (CompartmentsInZoneIter comp(zone); !comp.done(); comp.next())
                 js_delete(comp.get());
             js_delete(zone.get());
         }
     }
 
     zones.clear();