Bug 1122408 - Fix potential deadlock codepath. r=BenWa, a=sledru
authorKartikaya Gupta <kgupta@mozilla.com>
Sat, 17 Jan 2015 10:25:57 -0500
changeset 242915 e6df6527d52e
parent 242914 8d886705af93
child 242916 d1b7588f273b
push id4340
push userryanvm@gmail.com
push date2015-01-20 15:10 +0000
treeherdermozilla-beta@d1b7588f273b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBenWa, sledru
bugs1122408
milestone36.0
Bug 1122408 - Fix potential deadlock codepath. r=BenWa, a=sledru
gfx/layers/ipc/CompositorParent.cpp
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -1231,33 +1231,34 @@ CompositorParent* CompositorParent::Remo
   CompositorParent *retval = it->second;
   sCompositorMap->erase(it);
   return retval;
 }
 
 bool
 CompositorParent::RecvNotifyChildCreated(const uint64_t& child)
 {
+  MonitorAutoLock lock(*sIndirectLayerTreesLock);
   NotifyChildCreated(child);
   return true;
 }
 
 void
 CompositorParent::NotifyChildCreated(const uint64_t& aChild)
 {
-  MonitorAutoLock lock(*sIndirectLayerTreesLock);
+  sIndirectLayerTreesLock->AssertCurrentThreadOwns();
   sIndirectLayerTrees[aChild].mParent = this;
   sIndirectLayerTrees[aChild].mLayerManager = mLayerManager;
 }
 
 bool
 CompositorParent::RecvAdoptChild(const uint64_t& child)
 {
+  MonitorAutoLock lock(*sIndirectLayerTreesLock);
   NotifyChildCreated(child);
-  MonitorAutoLock lock(*sIndirectLayerTreesLock);
   if (sIndirectLayerTrees[child].mLayerTree) {
     sIndirectLayerTrees[child].mLayerTree->mLayerManager = mLayerManager;
   }
   if (sIndirectLayerTrees[child].mRoot) {
     sIndirectLayerTrees[child].mRoot->AsLayerComposite()->SetLayerManager(mLayerManager);
   }
   return true;
 }