# HG changeset patch # User sotaro # Date 1520916787 -32400 # Node ID b821737a49f966403c2cff7c4a4a302dc787c5af # Parent 2bca446bdc22dc4944face48a75202a308e221a2 Bug 1426588 - Add more check to CrossProcessCompositorBridgeParent::AllocPWebRenderBridgeParent() r=nical diff --git a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp --- a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp @@ -211,28 +211,33 @@ CrossProcessCompositorBridgeParent::Allo MOZ_ASSERT(sIndirectLayerTrees.find(layersId) != sIndirectLayerTrees.end()); MOZ_ASSERT(sIndirectLayerTrees[layersId].mWrBridge == nullptr); WebRenderBridgeParent* parent = nullptr; WebRenderBridgeParent* root = nullptr; CompositorBridgeParent* cbp = sIndirectLayerTrees[layersId].mParent; if (cbp) { root = sIndirectLayerTrees[cbp->RootLayerTreeId()].mWrBridge.get(); } - if (!root) { + + RefPtr api; + if (root) { + api = root->GetWebRenderAPI(); + } + + if (!root || !api) { // This could happen when this function is called after CompositorBridgeParent destruction. // This was observed during Tab move between different windows. - NS_WARNING("Created child without a matching parent?"); + NS_WARNING(nsPrintfCString("Created child without a matching parent? root %p", root).get()); parent = WebRenderBridgeParent::CreateDestroyed(aPipelineId); parent->AddRef(); // IPDL reference *aIdNamespace = parent->GetIdNamespace(); *aTextureFactoryIdentifier = TextureFactoryIdentifier(LayersBackend::LAYERS_NONE); return parent; } - RefPtr api = root->GetWebRenderAPI(); api = api->Clone(); RefPtr holder = root->AsyncImageManager(); RefPtr animStorage = cbp->GetAnimationStorage(); parent = new WebRenderBridgeParent(this, aPipelineId, nullptr, root->CompositorScheduler(), Move(api), Move(holder), Move(animStorage)); parent->AddRef(); // IPDL reference sIndirectLayerTrees[layersId].mCrossProcessParent = this; sIndirectLayerTrees[layersId].mWrBridge = parent;