From a7c14e2f29831f4bc5eb18e23e55eb6f7a4e3431 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 8 Apr 2024 17:12:12 +0200 Subject: Merging upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- gfx/ipc/InProcessCompositorSession.cpp | 5 ++++- gfx/ipc/RemoteCompositorSession.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'gfx/ipc') diff --git a/gfx/ipc/InProcessCompositorSession.cpp b/gfx/ipc/InProcessCompositorSession.cpp index f5f94461cb..9efb83b57a 100644 --- a/gfx/ipc/InProcessCompositorSession.cpp +++ b/gfx/ipc/InProcessCompositorSession.cpp @@ -61,7 +61,10 @@ RefPtr InProcessCompositorSession::Create( } void InProcessCompositorSession::NotifySessionLost() { - mWidget->NotifyCompositorSessionLost(this); + // Hold a reference to mWidget since NotifyCompositorSessionLost may + // release the last reference mid-execution. + RefPtr widget(mWidget); + widget->NotifyCompositorSessionLost(this); } CompositorBridgeParent* InProcessCompositorSession::GetInProcessBridge() const { diff --git a/gfx/ipc/RemoteCompositorSession.cpp b/gfx/ipc/RemoteCompositorSession.cpp index bbd8ddd13f..34b7cd4856 100644 --- a/gfx/ipc/RemoteCompositorSession.cpp +++ b/gfx/ipc/RemoteCompositorSession.cpp @@ -46,10 +46,13 @@ RemoteCompositorSession::~RemoteCompositorSession() { } void RemoteCompositorSession::NotifySessionLost() { + // Hold a reference to mWidget since NotifyCompositorSessionLost may + // release the last reference mid-execution. + RefPtr widget(mWidget); // Re-entrancy should be impossible: when we are being notified of a lost // session, we have by definition not shut down yet. We will shutdown, but // then will be removed from the notification list. - mWidget->NotifyCompositorSessionLost(this); + widget->NotifyCompositorSessionLost(this); } CompositorBridgeParent* RemoteCompositorSession::GetInProcessBridge() const { -- cgit v1.2.3