xwayland: Handle shutting down without having started

We initialize, but might not start, e.g. when a test case just needs a
backend and doesn't start mutter. When cleaning up, we'll still try to
clean up Xwayland integration, and this commit handles cleaning up
without having made the mess.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1856>
This commit is contained in:
Jonas Ådahl 2021-05-06 11:02:42 +02:00
parent 1a43312b96
commit 4490d4524b
2 changed files with 9 additions and 4 deletions

View File

@ -595,7 +595,7 @@ meta_wayland_finalize (void)
if (compositor->wayland_display)
wl_display_destroy_clients (compositor->wayland_display);
meta_wayland_seat_free (compositor->seat);
g_clear_pointer (&compositor->seat, meta_wayland_seat_free);
g_clear_pointer (&compositor->display_name, g_free);
g_clear_pointer (&compositor->wayland_display, wl_display_destroy);

View File

@ -1286,7 +1286,8 @@ void
meta_xwayland_shutdown (MetaXWaylandManager *manager)
{
#ifdef HAVE_XSETIOERROREXITHANDLER
MetaX11Display *x11_display = meta_get_display ()->x11_display;
MetaDisplay *display = meta_get_display ();
MetaX11Display *x11_display;
#endif
char path[256];
@ -1294,8 +1295,12 @@ meta_xwayland_shutdown (MetaXWaylandManager *manager)
XSetIOErrorHandler (x_io_error_noop);
#ifdef HAVE_XSETIOERROREXITHANDLER
XSetIOErrorExitHandler (meta_x11_display_get_xdisplay (x11_display),
x_io_error_exit_noop, NULL);
x11_display = display->x11_display;
if (x11_display)
{
XSetIOErrorExitHandler (meta_x11_display_get_xdisplay (x11_display),
x_io_error_exit_noop, NULL);
}
#endif
meta_xwayland_terminate (manager);