remove-manual-addrefs
author Benjamin Smedberg <benjamin@smedbergs.us>
Sat, 26 Jul 2008 22:49:39 -0400
changeset 167 a4da40849f5436e629c5732f4368c6c48189637f
parent 117 1cf47cdb0feb0184e26baf4fe93127d2a286247f
permissions -rw-r--r--
State as of now

diff --git a/rdf/base/src/nsInMemoryDataSource.cpp b/rdf/base/src/nsInMemoryDataSource.cpp
--- a/rdf/base/src/nsInMemoryDataSource.cpp
+++ b/rdf/base/src/nsInMemoryDataSource.cpp
@@ -275,7 +275,6 @@ Assertion::DeletePropertyHashEntry(PLDHa
 
         // Unlink, and release the datasource's reference.
         doomed->mNext = doomed->u.as.mInvNext = nsnull;
-        doomed->Release(*allocator);
     }
     return PL_DHASH_NEXT;
 }
@@ -488,10 +487,6 @@ InMemoryAssertionEnumeratorImpl::InMemor
     else {
         mNextAssertion = mDataSource->GetReverseArcs(mTarget);
     }
-
-    // Add an owning reference from the enumerator
-    if (mNextAssertion)
-        mNextAssertion->AddRef();
 }
 
 InMemoryAssertionEnumeratorImpl::~InMemoryAssertionEnumeratorImpl()
@@ -500,9 +495,6 @@ InMemoryAssertionEnumeratorImpl::~InMemo
     --gInstanceCount;
     fprintf(stdout, "%d - RDF: InMemoryAssertionEnumeratorImpl\n", gInstanceCount);
 #endif
-
-    if (mNextAssertion)
-        mNextAssertion->Release(mDataSource->mAllocator);
 
     NS_IF_RELEASE(mDataSource);
     NS_IF_RELEASE(mSource);
@@ -540,13 +532,6 @@ InMemoryAssertionEnumeratorImpl::HasMore
 
         // iterate
         mNextAssertion = (mSource) ? mNextAssertion->mNext : mNextAssertion->u.as.mInvNext;
-
-        // grab an owning reference from the enumerator to the next assertion
-        if (mNextAssertion)
-            mNextAssertion->AddRef();
-
-        // ...and release the reference from the enumerator to the old one.
-        as->Release(mDataSource->mAllocator);
 
         if (foundIt) {
             *aResult = PR_TRUE;
@@ -795,9 +780,7 @@ NS_NewRDFInMemoryDataSource(nsISupports*
 
     nsresult rv = datasource->Init();
     if (NS_SUCCEEDED(rv)) {
-        datasource->fAggregated.AddRef();
         rv = datasource->AggregatedQueryInterface(aIID, aResult); // This'll AddRef()
-        datasource->fAggregated.Release();
     }
 
     NS_RELEASE(datasource);
@@ -895,7 +878,6 @@ InMemoryDataSource::DeleteForwardArcsEnt
 
         // Unlink, and release the datasource's reference.
         doomed->mNext = doomed->u.as.mInvNext = nsnull;
-        doomed->Release(*allocator);
     }
     return PL_DHASH_NEXT;
 }
@@ -1226,9 +1208,6 @@ InMemoryDataSource::LockedAssert(nsIRDFR
     if (! as)
         return NS_ERROR_OUT_OF_MEMORY;
 
-    // Add the datasource's owning reference.
-    as->AddRef();
-
     if (haveHash)
     {
         PLDHashEntryHdr* hdr = PL_DHashTableOperate(next->u.hash.mPropertyHash,
@@ -1428,7 +1407,6 @@ InMemoryDataSource::LockedUnassert(nsIRD
 
     // Unlink, and release the datasource's reference
     as->mNext = as->u.as.mInvNext = nsnull;
-    as->Release(mAllocator);
 
     return NS_OK;
 }
@@ -1787,9 +1765,6 @@ InMemoryDataSource::EnsureFastContainmen
     NS_ASSERTION(hashAssertion, "unable to Assertion::Create");
     if (!hashAssertion) return(NS_ERROR_OUT_OF_MEMORY);
 
-    // Add the datasource's owning reference.
-    hashAssertion->AddRef();
-
     register Assertion *first = GetForwardArcs(aSource);
     SetForwardArcs(aSource, hashAssertion);
 
@@ -1951,7 +1926,6 @@ InMemoryDataSource::Sweep()
 
         // Unlink, and release the datasource's reference
         doomed->mNext = doomed->u.as.mInvNext = nsnull;
-        doomed->Release(mAllocator);
     }
 
     return NS_OK;
diff --git a/xpcom/io/nsFastLoadFile.cpp b/xpcom/io/nsFastLoadFile.cpp
--- a/xpcom/io/nsFastLoadFile.cpp
+++ b/xpcom/io/nsFastLoadFile.cpp
@@ -2068,7 +2068,6 @@ nsFastLoadFileWriter::WriteObjectCommon(
                  "odd nsISupports*, oh no!");
 
     // Here be manual refcounting dragons!
-    rc = aObject->AddRef();
     NS_ASSERTION(rc != 0, "bad refcnt when writing aObject!");
 
     NSFastLoadOID oid;
@@ -2080,7 +2079,6 @@ nsFastLoadFileWriter::WriteObjectCommon(
         // refs (one from the AddRef above, one from the data structure that's
         // being serialized).
         oid = MFL_DULL_OBJECT_OID;
-        aObject->Release();
     } else {
         // Object is presumed to be multiply connected through some combo of
         // strong and weak refs.  Hold onto it via mObjectMap.
@@ -2089,7 +2087,6 @@ nsFastLoadFileWriter::WriteObjectCommon(
                        (PL_DHashTableOperate(&mObjectMap, aObject,
                                                 PL_DHASH_ADD));
         if (!entry) {
-            aObject->Release();
             return NS_ERROR_OUT_OF_MEMORY;
         }
 
@@ -2099,7 +2096,6 @@ nsFastLoadFileWriter::WriteObjectCommon(
             PRInt64 thisOffset;
             rv = Tell(&thisOffset);
             if (NS_FAILED(rv)) {
-                aObject->Release();
                 return rv;
             }
 
@@ -2142,8 +2138,6 @@ nsFastLoadFileWriter::WriteObjectCommon(
                 NS_ASSERTION(MFL_GET_WEAK_REFCNT(&entry->mInfo) != 0,
                              "mWeakRefCnt overflow");
             }
-
-            aObject->Release();
         }
     }