nsChainedEventQueue-gcobject
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 158 3bc262b4ce406d09f2a6edd0a29be5a5fba52b55
permissions -rw-r--r--
State as of now

diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -622,7 +622,6 @@ nsThread::PushEventQueue(nsIThreadEventF
 {
   nsChainedEventQueue *queue = new nsChainedEventQueue(filter);
   if (!queue || !queue->IsInitialized()) {
-    delete queue;
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
@@ -647,8 +646,6 @@ nsThread::PopEventQueue()
   while (queue->GetEvent(PR_FALSE, &event))
     mEvents->PutEvent(event);
 
-  delete queue;
-  
   return NS_OK;
 }
 
diff --git a/xpcom/threads/nsThread.h b/xpcom/threads/nsThread.h
--- a/xpcom/threads/nsThread.h
+++ b/xpcom/threads/nsThread.h
@@ -98,7 +98,10 @@ private:
   nsresult PutEvent(nsIRunnable *event);
 
   // Wrapper for nsEventQueue that supports chaining.
-  class nsChainedEventQueue {
+  class nsChainedEventQueue
+    : public XPCOMGCFinalizedObject
+    , MMgc::GCFinalizable
+  {
   public:
     nsChainedEventQueue(nsIThreadEventFilter *filter = nsnull)
       : mNext(nsnull), mFilter(filter) {