[mutter/wip/wayland-display: 48/93] MetaWayland: install an X io error handler



commit ab4ed3c4963224fe4ab0835d78eb9681eb8ed69d
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Mon Aug 12 15:31:18 2013 +0200

    MetaWayland: install an X io error handler
    
    This way can detect X disconnections correctly, crash with a core
    dump and reset the tty.

 src/wayland/meta-xwayland.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index aa53a08..ea6431f 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -311,6 +311,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)
 {
@@ -432,6 +440,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;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]