[Xquartz-changes] xserver: Branch 'for-keith' - 2 commits

Jeremy Huddleston jeremyhu at freedesktop.org
Mon Oct 10 20:41:34 PDT 2011


Rebased ref, commits from common ancestor:
commit db30615bcb3b872475e7d40eeee8cdda5b723078
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon Oct 10 12:16:31 2011 -0700

    Xephyr: Remove socket and its lock file on exit
    
    https://bugs.freedesktop.org/show_bug.cgi?id=11484
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>

diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c
index 4caf451..47a6681 100644
--- a/hw/kdrive/ephyr/hostx.c
+++ b/hw/kdrive/ephyr/hostx.c
@@ -45,6 +45,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <string.h> 		/* for memset */
+#include <errno.h>
 #include <time.h>
 
 #include <sys/ipc.h>
@@ -331,6 +332,14 @@ hostx_set_title (char *title)
   ephyrTitle = title;
 }
 
+static int _X_NORETURN
+x_io_error_handler (Display *dpy) {
+    ErrorF("Lost connection to X server: %s\n", strerror(errno));
+    CloseWellKnownConnections();
+    OsCleanup(1);
+    exit(1);
+}
+
 int
 hostx_init (void)
 {
@@ -358,6 +367,8 @@ hostx_init (void)
       exit(1);
     }
 
+  XSetIOErrorHandler(x_io_error_handler);
+
   HostX.screen  = DefaultScreen(HostX.dpy);
   HostX.winroot = RootWindow(HostX.dpy, HostX.screen);
   HostX.gc      = XCreateGC(HostX.dpy, HostX.winroot, 0, NULL);
commit c13a48e74ec89eafa9b529a87253a631ef02f2e2
Author: Jeremy Huddleston <jeremyhu at apple.com>
Date:   Mon Oct 10 12:09:39 2011 -0700

    Xnest: Remove socket and its lock file on exit
    
    https://bugs.freedesktop.org/show_bug.cgi?id=11484
    
    Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
    Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>

diff --git a/hw/xnest/Display.c b/hw/xnest/Display.c
index b78aff5..7acad75 100644
--- a/hw/xnest/Display.c
+++ b/hw/xnest/Display.c
@@ -17,6 +17,9 @@ is" without express or implied warranty.
 #include <xnest-config.h>
 #endif
 
+#include <string.h>
+#include <errno.h>
+
 #include <X11/X.h>
 #include <X11/Xproto.h>
 #include "screenint.h"
@@ -52,6 +55,14 @@ Pixmap xnestScreenSaverPixmap;
 XlibGC xnestBitmapGC;
 unsigned long xnestEventMask;
 
+static int _X_NORETURN
+x_io_error_handler (Display *dpy) {
+    ErrorF("Lost connection to X server: %s\n", strerror(errno));
+    CloseWellKnownConnections();
+    OsCleanup(1);
+    exit(1);
+}
+
 void
 xnestOpenDisplay(int argc, char *argv[])
 {
@@ -60,7 +71,9 @@ xnestOpenDisplay(int argc, char *argv[])
   int i, j;
 
   if (!xnestDoFullGeneration) return;
-  
+
+  XSetIOErrorHandler(x_io_error_handler);
+
   xnestCloseDisplay();
 
   xnestDisplay = XOpenDisplay(xnestDisplayName);
diff --git a/hw/xnest/Events.c b/hw/xnest/Events.c
index 619427d..2399313 100644
--- a/hw/xnest/Events.c
+++ b/hw/xnest/Events.c
@@ -198,6 +198,8 @@ xnestCollectEvents(void)
     case DestroyNotify:
       if (xnestParentWindow != (Window) 0 &&
 	  X.xdestroywindow.window == xnestParentWindow)
+	CloseWellKnownConnections();
+	OsCleanup(1);
 	exit (0);
       break;
 


More information about the Xquartz-changes mailing list