diff --git a/gfx/layers/ipc/CompositorBridgeChild.cpp b/gfx/layers/ipc/CompositorBridgeChild.cpp index a61cf7b8c2ad..6014a674ded3 100644 --- a/gfx/layers/ipc/CompositorBridgeChild.cpp +++ b/gfx/layers/ipc/CompositorBridgeChild.cpp @@ -113,15 +113,6 @@ CompositorBridgeChild::Destroy() layers->Destroy(); } - const ManagedContainer& textures = ManagedPTextureChild(); - for (auto iter = textures.ConstIter(); !iter.Done(); iter.Next()) { - RefPtr texture = TextureClient::AsTextureClient(iter.Get()->GetKey()); - - if (texture) { - texture->Destroy(); - } - } - SendWillClose(); mCanSend = false; @@ -137,6 +128,16 @@ CompositorBridgeChild::Destroy() // From now on we can't send any message message. MessageLoop::current()->PostTask( NewRunnableFunction(DeferredDestroyCompositor, mCompositorBridgeParent, selfRef)); + + const ManagedContainer& textures = ManagedPTextureChild(); + for (auto iter = textures.ConstIter(); !iter.Done(); iter.Next()) { + RefPtr texture = TextureClient::AsTextureClient(iter.Get()->GetKey()); + + if (texture) { + texture->Destroy(); + } + } + } // static