MetaWayland: install an X io error handler

This way can detect X disconnections correctly, crash with a core
dump and reset the tty.
This commit is contained in:
Giovanni Campagna 2013-08-12 15:31:18 +02:00
parent 43d499318f
commit 5f4121830c

View File

@ -301,6 +301,14 @@ xserver_died (GPid pid,
}
}
static int
x_io_error (Display *display)
{
g_error ("Connection to xwayland lost");
return 0;
}
gboolean
meta_xwayland_start (MetaWaylandCompositor *compositor)
{
@ -422,6 +430,13 @@ meta_xwayland_start (MetaWaylandCompositor *compositor)
g_main_loop_run (compositor->init_loop);
/* 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
enough, and therefore we won't crash when X exits (and most important
we won't reset the tty).
*/
XSetIOErrorHandler (x_io_error);
return TRUE;
}