XPCJSContextStack-is-gcfinalizable
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 160 fd41ae75c7983b0c8aeff594c5c4cb25cde2ce5e
permissions -rw-r--r--
State as of now

diff --git a/js/src/xpconnect/src/xpcprivate.h b/js/src/xpconnect/src/xpcprivate.h
--- a/js/src/xpconnect/src/xpcprivate.h
+++ b/js/src/xpconnect/src/xpcprivate.h
@@ -2811,7 +2811,9 @@ struct XPCJSContextInfo {
     jsrefcount requestDepth;
 };
 
-class XPCJSContextStack
+class NS_GC_TYPE NS_FINAL_CLASS XPCJSContextStack
+    : public MMgc::GCFinalizable
+    , public XPCOMGCFinalizedObject
 {
 public:
     NS_DECL_NSIJSCONTEXTSTACK
diff --git a/js/src/xpconnect/src/xpcthreadcontext.cpp b/js/src/xpconnect/src/xpcthreadcontext.cpp
--- a/js/src/xpconnect/src/xpcthreadcontext.cpp
+++ b/js/src/xpconnect/src/xpcthreadcontext.cpp
@@ -479,7 +479,6 @@ XPCPerThreadData::Cleanup()
         mAutoRoots->Unlink();
     NS_IF_RELEASE(mExceptionManager);
     NS_IF_RELEASE(mException);
-    delete mJSContextStack;
     mJSContextStack = nsnull;
 }
 
@@ -645,12 +644,7 @@ XPCPerThreadData::CleanupAllThreads()
         }
     }
 
-    if(stacks)
-    {
-        for(i = 0; i < count; i++)
-            delete stacks[i];
-        delete [] stacks;
-    }
+    delete [] stacks;
 
     if(gTLSIndex != BAD_TLS_INDEX)
         PR_SetThreadPrivate(gTLSIndex, nsnull);