nsProtocolProxyService-FilterLink-gcobject
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/netwerk/base/src/nsProtocolProxyService.cpp b/netwerk/base/src/nsProtocolProxyService.cpp
--- a/netwerk/base/src/nsProtocolProxyService.cpp
+++ b/netwerk/base/src/nsProtocolProxyService.cpp
@@ -359,7 +359,7 @@ nsProtocolProxyService::Observe(nsISuppo
             mHostFiltersArray.Clear();
         }
         if (mFilters) {
-            delete mFilters;
+            NS_GetGC()->Free(mFilters);
             mFilters = nsnull;
         }
         if (mPACMan) {
@@ -1031,7 +1031,7 @@ nsProtocolProxyService::UnregisterFilter
             else
                 mFilters = iter->next;
             iter->next = nsnull;
-            delete iter;
+            NS_GetGC()->Free(iter);
             return NS_OK;
         }
         last = iter;
diff --git a/netwerk/base/src/nsProtocolProxyService.h b/netwerk/base/src/nsProtocolProxyService.h
--- a/netwerk/base/src/nsProtocolProxyService.h
+++ b/netwerk/base/src/nsProtocolProxyService.h
@@ -340,16 +340,13 @@ protected:
     };
 
     // This structure is allocated for each registered nsIProtocolProxyFilter.
-    struct FilterLink {
+    struct FilterLink : public XPCOMGCObject {
       struct FilterLink                *next;
       PRUint32                          position;
       nsCOMPtr<nsIProtocolProxyFilter>  filter;
 
       FilterLink(PRUint32 p, nsIProtocolProxyFilter *f)
         : next(nsnull), position(p), filter(f) {}
-
-      // Chain deletion to simplify cleaning up the filter links
-      ~FilterLink() { if (next) delete next; }
     };
 
     // Holds an array of HostInfo objects