[PATCH] Xnest: Remove socket and its lock file on exit

Jeremy Huddleston jeremyhu at apple.com
Mon Oct 10 12:19:19 PDT 2011


https://bugs.freedesktop.org/show_bug.cgi?id=11484

Signed-off-by: Jeremy Huddleston <jeremyhu at apple.com>
---
 hw/xnest/Display.c |   11 ++++++++++-
 hw/xnest/Events.c  |    2 ++
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/hw/xnest/Display.c b/hw/xnest/Display.c
index b78aff5..e7bf249 100644
--- a/hw/xnest/Display.c
+++ b/hw/xnest/Display.c
@@ -52,6 +52,13 @@ Pixmap xnestScreenSaverPixmap;
 XlibGC xnestBitmapGC;
 unsigned long xnestEventMask;
 
+static int _X_NORETURN
+x_io_error_handler (Display *dpy) {
+    CloseWellKnownConnections();
+    OsCleanup(1);
+    exit(0);
+}
+
 void
 xnestOpenDisplay(int argc, char *argv[])
 {
@@ -60,7 +67,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;
 
-- 
1.7.5.4




More information about the xorg-devel mailing list