diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2011-10-10 12:09:39 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2011-10-10 20:40:44 -0700 |
commit | c13a48e74ec89eafa9b529a87253a631ef02f2e2 (patch) | |
tree | 01e678507c66d2f569bb3645994e03dde6a3b171 | |
parent | 8b29addc30163bb7ba74c74351f312aac02f049a (diff) |
Xnest: Remove socket and its lock file on exit
https://bugs.freedesktop.org/show_bug.cgi?id=11484
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
-rw-r--r-- | hw/xnest/Display.c | 15 | ||||
-rw-r--r-- | hw/xnest/Events.c | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/hw/xnest/Display.c b/hw/xnest/Display.c index b78aff597..7acad755c 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 619427ded..2399313c6 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; |