Bug 797515 - Fix race condition in assertion in ContentParent::~ContentParent. r=cjones
☠☠ backed out by 16ac5cbc7793 ☠ ☠
authorJustin Lebar <justin.lebar@gmail.com>
Wed, 03 Oct 2012 20:45:40 -0400
changeset 109284 99caa1f41fe18c7a997a6a3d6d619bbd876c07ba
parent 109283 0910857eb29404e40e2b39caf67b8eaa5ca51133
child 109285 a04b83c532975b414c8f37936ab1e57075d85391
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewerscjones
bugs797515
milestone18.0a1
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;
 }