xwayland: Destroy selection bridge windows before closing X11 display

Listen to the "x11-display-closing" signal so we can destroy the X11
selection bridge related windows before the X11 display is gone.

https://bugzilla.gnome.org/show_bug.cgi?id=759538
This commit is contained in:
Jonas Ådahl 2018-06-30 09:04:48 +02:00
parent de5e7a7175
commit 89727aa747
3 changed files with 11 additions and 4 deletions

View File

@ -29,7 +29,7 @@ meta_xwayland_start (MetaXWaylandManager *manager,
struct wl_display *display);
void
meta_xwayland_complete_init (void);
meta_xwayland_complete_init (MetaDisplay *display);
void
meta_xwayland_stop (MetaXWaylandManager *manager);

View File

@ -550,9 +550,15 @@ out:
return started;
}
static void
on_x11_display_closing (MetaDisplay *display)
{
meta_xwayland_shutdown_selection ();
}
/* To be called right after connecting */
void
meta_xwayland_complete_init (void)
meta_xwayland_complete_init (MetaDisplay *display)
{
/* We install an X IO error handler in addition to the child watch,
because after Xlib connects our child watch may not be called soon
@ -561,6 +567,8 @@ meta_xwayland_complete_init (void)
*/
XSetIOErrorHandler (x_io_error);
g_signal_connect (display, "x11-display-closing",
G_CALLBACK (on_x11_display_closing), NULL);
meta_xwayland_init_selection ();
}
@ -570,7 +578,6 @@ meta_xwayland_stop (MetaXWaylandManager *manager)
char path[256];
g_cancellable_cancel (manager->xserver_died_cancellable);
meta_xwayland_shutdown_selection ();
g_clear_object (&manager->proc);
g_clear_object (&manager->xserver_died_cancellable);

View File

@ -1005,7 +1005,7 @@ meta_x11_display_new (MetaDisplay *display, GError **error)
#ifdef HAVE_WAYLAND
if (meta_is_wayland_compositor ())
meta_xwayland_complete_init ();
meta_xwayland_complete_init (display);
#endif
if (meta_is_syncing ())