compositor: Reparent the backend window unmanaging the display

Under X11 hiding the backend implies also unmapping the stage window, if
we do that after that we've closed the display we may end up in a
BadWindow error because such window seems to be destroyed together with
the compositor output parent (even though we are not notified about), so
to prevent this, reparent the backend window during compositor unmanage,
setting it back as a root window child.

Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2835
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3020>
This commit is contained in:
Jonas Ådahl 2023-05-29 14:12:19 +02:00 committed by Marge Bot
parent f013764b57
commit 340d585f91
2 changed files with 6 additions and 1 deletions

View File

@ -205,11 +205,17 @@ static void
meta_compositor_x11_unmanage (MetaCompositor *compositor)
{
MetaDisplay *display = meta_compositor_get_display (compositor);
MetaContext *context = meta_display_get_context (display);
MetaBackend *backend = meta_context_get_backend (context);
MetaX11Display *x11_display = display->x11_display;
Display *xdisplay = x11_display->xdisplay;
Window xroot = x11_display->xroot;
Window backend_xwindow;
MetaCompositorClass *parent_class;
backend_xwindow = meta_backend_x11_get_xwindow (META_BACKEND_X11 (backend));
XReparentWindow (xdisplay, backend_xwindow, xroot, 0, 0);
/*
* This is the most important part of cleanup - we have to do this before
* giving up the window manager selection or the next window manager won't be

View File

@ -684,7 +684,6 @@ if have_x11
],
env: x11_env,
suite: ['core', 'mutter/x11'],
should_fail: mode == 'sync',
is_parallel: false,
timeout: 60,
)