Bug 797515 - Fix race condition in assertion in ContentParent::~ContentParent. r=cjones
authorJustin Lebar <justin.lebar@gmail.com>
Thu, 04 Oct 2012 00:44:50 -0400
changeset 115503 f9d8e474c709c0c679786127187969c96d5f7899
parent 115502 1cceedd227a7427bfcc764fd583a2631603eaf07
child 115504 bd97a43a46038f520944b36726e35303534bda44
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs797515
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 797515 - Fix race condition in assertion in ContentParent::~ContentParent. r=cjones
dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -769,18 +769,22 @@ ContentParent::~ContentParent()
     NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
     // We should be removed from all these lists in ActorDestroy.
     MOZ_ASSERT(!gPrivateContent || !gPrivateContent->Contains(this));
     if (mAppManifestURL.IsEmpty()) {
         MOZ_ASSERT(!gNonAppContentParents ||
                    !gNonAppContentParents->Contains(this));
     } else {
+        // In general, we expect gAppContentParents->Get(mAppManifestURL) to be
+        // NULL.  But it could be that we created another ContentParent for this
+        // app after we did this->ActorDestroy(), so the right check is that
+        // gAppContentParent->Get(mAppManifestURL) != this.
         MOZ_ASSERT(!gAppContentParents ||
-                   !gAppContentParents->Get(mAppManifestURL));
+                   gAppContentParents->Get(mAppManifestURL) != this);
     }
 }
 
 bool
 ContentParent::IsAlive()
 {
     return mIsAlive;
 }