observerlist-gc
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 58 8ecbd849199dbe6e9e281aa564c617fd9eba4899
permissions -rw-r--r--
State as of now

diff --git a/xpcom/ds/nsObserverList.cpp b/xpcom/ds/nsObserverList.cpp
--- a/xpcom/ds/nsObserverList.cpp
+++ b/xpcom/ds/nsObserverList.cpp
@@ -54,7 +54,7 @@ nsObserverList::AddObserver(nsIObserver*
         return NS_OK;
     }
         
-    nsCOMPtr<nsIWeakReference> weak = do_GetWeakReference(anObserver);
+    nsIWeakReference* weak = do_GetWeakReference(anObserver);
     if (!weak)
         return NS_NOINTERFACE;
 
@@ -90,7 +90,7 @@ nsObserverList::GetObserverList(nsISimpl
     if (!e)
         return NS_ERROR_OUT_OF_MEMORY;
 
-    NS_ADDREF(*anEnumerator = e);
+    *anEnumerator = e;
     return NS_OK;
 }
 
@@ -152,7 +152,7 @@ nsObserverEnumerator::GetNext(nsISupport
         return NS_ERROR_UNEXPECTED;
     }
 
-    NS_ADDREF(*aResult = mObservers[mIndex]);
+    *aResult = mObservers[mIndex];
     ++mIndex;
     return NS_OK;
 }
diff --git a/xpcom/ds/nsObserverList.h b/xpcom/ds/nsObserverList.h
--- a/xpcom/ds/nsObserverList.h
+++ b/xpcom/ds/nsObserverList.h
@@ -93,10 +93,10 @@ public:
   void FillObserverArray(nsCOMArray<nsIObserver> &aArray);
 
 private:
-  nsTArray<ObserverRef> mObservers;
+  nsTArray<ObserverRef, GCAllocator> mObservers;
 };
 
-class nsObserverEnumerator : public nsISimpleEnumerator
+class nsObserverEnumerator : public XPCOMGCFinalizedObject, public nsISimpleEnumerator
 {
 public:
     NS_DECL_ISUPPORTS