Bug 968001 - In OpSetRoot, check that the new root is a root - r=nical
authorBenoit Jacob <bjacob@mozilla.com>
Thu, 20 Feb 2014 15:05:08 -0500
changeset 170100 017de48b754f5f82a2be4b56c6a4c1cb3975d9ee
parent 170099 2ea5f9a5272ebd6c083fa2935c95dc483e925aa7
child 170101 3bfe9190b72d40b956bd99600ea3d940d843b8db
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersnical
bugs968001
milestone30.0a1
Bug 968001 - In OpSetRoot, check that the new root is a root - r=nical
gfx/layers/ipc/LayerTransactionParent.cpp
--- a/gfx/layers/ipc/LayerTransactionParent.cpp
+++ b/gfx/layers/ipc/LayerTransactionParent.cpp
@@ -385,17 +385,21 @@ LayerTransactionParent::RecvUpdate(const
       mLayerManager->GetCompositor()->SetDiagnosticTypes(
         edit.get_OpSetDiagnosticTypes().diagnostics());
       break;
     }
     // Tree ops
     case Edit::TOpSetRoot: {
       MOZ_LAYERS_LOG(("[ParentSide] SetRoot"));
 
-      mRoot = AsLayerComposite(edit.get_OpSetRoot())->AsLayer();
+      Layer* newRoot = AsLayerComposite(edit.get_OpSetRoot())->AsLayer();
+      if (newRoot->GetParent()) {
+        return false;
+      }
+      mRoot = newRoot;
       break;
     }
     case Edit::TOpInsertAfter: {
       MOZ_LAYERS_LOG(("[ParentSide] InsertAfter"));
 
       const OpInsertAfter& oia = edit.get_OpInsertAfter();
       ShadowContainer(oia)->AsContainerLayerComposite()->InsertAfter(
         ShadowChild(oia)->AsLayer(), ShadowAfter(oia)->AsLayer());