From 506151ac79fb5fc5b7bf0f014da3fda495dd3676 Mon Sep 17 00:00:00 2001 From: stransky Date: Thu, 29 Feb 2024 10:59:14 +0000 Subject: [PATCH] Bug 1882021 [Linux/X11] Clean up XWindow from GtkCompositorWidget and disable rendering if nsWindow is unmapped r=emilio Differential Revision: https://phabricator.services.mozilla.com/D203104 --- widget/gtk/nsWindow.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index 221faabeab01..4e96f8218784 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -615,8 +615,6 @@ void nsWindow::Destroy() { DestroyLayerManager(); - mSurfaceProvider.CleanupResources(); - g_signal_handlers_disconnect_by_data(gtk_settings_get_default(), this); if (mIMContext) { @@ -4123,6 +4121,16 @@ void nsWindow::OnUnmap() { mSourceDragContext = nullptr; } } + + // We don't have valid XWindow any more, + // so clear stored ones at GtkCompositorWidget() for OMTC rendering + // and mSurfaceProvider for legacy rendering. + if (GdkIsX11Display()) { + mSurfaceProvider.CleanupResources(); + if (mCompositorWidgetDelegate) { + mCompositorWidgetDelegate->DisableRendering(); + } + } } void nsWindow::OnSizeAllocate(GtkAllocation* aAllocation) {