diff --git a/gfx/layers/ipc/CompositorBridgeChild.cpp b/gfx/layers/ipc/CompositorBridgeChild.cpp index a3b1ac4cb512..55fd46d54a73 100644 --- a/gfx/layers/ipc/CompositorBridgeChild.cpp +++ b/gfx/layers/ipc/CompositorBridgeChild.cpp @@ -175,6 +175,12 @@ void CompositorBridgeChild::Destroy() { wrBridge->Destroy(/* aIsSync */ false); } + AutoTArray apzChildren; + ManagedPAPZChild(apzChildren); + for (PAPZChild* child : apzChildren) { + Unused << child->SendDestroy(); + } + const ManagedContainer& textures = ManagedPTextureChild(); for (auto iter = textures.ConstIter(); !iter.Done(); iter.Next()) { RefPtr texture = @@ -185,6 +191,9 @@ void CompositorBridgeChild::Destroy() { } } + // The WillClose message is synchronous, so we know that after it returns + // any messages sent by the above code will have been processed on the + // other side. SendWillClose(); mCanSend = false; diff --git a/gfx/layers/ipc/PAPZ.ipdl b/gfx/layers/ipc/PAPZ.ipdl index a738533cef5f..c66c7d26b936 100644 --- a/gfx/layers/ipc/PAPZ.ipdl +++ b/gfx/layers/ipc/PAPZ.ipdl @@ -47,7 +47,6 @@ sync protocol PAPZ manager PCompositorBridge; parent: - async __delete__(); child: @@ -71,6 +70,7 @@ child: async NotifyAsyncAutoscrollRejected(ViewID aScrollId); +both: async Destroy(); }; diff --git a/gfx/layers/ipc/RemoteContentController.cpp b/gfx/layers/ipc/RemoteContentController.cpp index 95dd265803e5..963fddd19a73 100644 --- a/gfx/layers/ipc/RemoteContentController.cpp +++ b/gfx/layers/ipc/RemoteContentController.cpp @@ -370,6 +370,13 @@ void RemoteContentController::Destroy() { } } +mozilla::ipc::IPCResult RemoteContentController::RecvDestroy() { + // The actor on the other side is about to get destroyed, so let's not send + // it any more messages. + mCanSend = false; + return IPC_OK(); +} + bool RemoteContentController::IsRemote() { return true; } } // namespace layers diff --git a/gfx/layers/ipc/RemoteContentController.h b/gfx/layers/ipc/RemoteContentController.h index dc44aa6333fa..10448d67ff2a 100644 --- a/gfx/layers/ipc/RemoteContentController.h +++ b/gfx/layers/ipc/RemoteContentController.h @@ -85,6 +85,7 @@ class RemoteContentController : public GeckoContentController, void ActorDestroy(ActorDestroyReason aWhy) override; void Destroy() override; + mozilla::ipc::IPCResult RecvDestroy(); bool IsRemote() override;