Bug 997908 - Add null check to ReleaseSliceNow() as bandaid for Mac topcrasher. r=smaug
authorSteven Michaud <smichaud@pobox.com>
Thu, 24 Apr 2014 11:46:39 -0500
changeset 180351 bace819903bbea609cbab39ccc26364ac3bb64ec
parent 180350 114a84c729dbf3be661d64405260fc6cda67e282
child 180352 5a0136e2cc357a4002328f781b8dc8cf8e894a94
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewerssmaug
bugs997908
milestone31.0a1
Bug 997908 - Add null check to ReleaseSliceNow() as bandaid for Mac topcrasher. r=smaug
xpcom/base/CycleCollectedJSRuntime.cpp
--- a/xpcom/base/CycleCollectedJSRuntime.cpp
+++ b/xpcom/base/CycleCollectedJSRuntime.cpp
@@ -1000,17 +1000,17 @@ ReleaseSliceNow(uint32_t aSlice, void* a
   uint32_t length = items->Length();
   aSlice = std::min(aSlice, length);
   for (uint32_t i = length; i > length - aSlice; --i) {
     // Remove (and NS_RELEASE) the last entry in "items":
     uint32_t lastItemIdx = i - 1;
 
     nsISupports* wrapper = items->ElementAt(lastItemIdx);
     items->RemoveElementAt(lastItemIdx);
-    NS_RELEASE(wrapper);
+    NS_IF_RELEASE(wrapper);
   }
 
   return items->IsEmpty();
 }
 
 /* static */ PLDHashOperator
 IncrementalFinalizeRunnable::DeferredFinalizerEnumerator(DeferredFinalizeFunction& aFunction,
                                                          void*& aData,