Commit 9341956c authored by Jan D's avatar Jan D

Don't access display after i/o error (Bug#19147).

* xterm.c (x_connection_closed): Add third arg ioerror.
If ioerror, set display to 0 (Bug#19147).
(x_error_quitter): Call x_connection_closed with third arg false.
(x_io_error_quitter): Call x_connection_closed with third arg true.
parent c0055ff5
......@@ -259,7 +259,7 @@ static int x_dispatch_event (XEvent *, Display *);
/* Don't declare this _Noreturn because we want no
interference with debugging failing X calls. */
static void x_connection_closed (Display *, const char *);
static void x_connection_closed (Display *, const char *, bool);
static void x_wm_set_window_state (struct frame *, int);
static void x_wm_set_icon_pixmap (struct frame *, ptrdiff_t);
static void x_initialize (void);
......@@ -8456,7 +8456,7 @@ static char *error_msg;
the text of an error message that lead to the connection loss. */
static void
x_connection_closed (Display *dpy, const char *error_message)
x_connection_closed (Display *dpy, const char *error_message, bool ioerror)
struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
Lisp_Object frame, tail;
......@@ -8475,6 +8475,7 @@ x_connection_closed (Display *dpy, const char *error_message)
if (ioerror) dpyinfo->display = 0;
/* First delete frames whose mini-buffers are on frames
that are on the dead display. */
......@@ -8612,7 +8613,7 @@ x_error_quitter (Display *display, XErrorEvent *event)
XGetErrorText (display, event->error_code, buf, sizeof (buf));
sprintf (buf1, "X protocol error: %s on protocol request %d",
buf, event->request_code);
x_connection_closed (display, buf1);
x_connection_closed (display, buf1, false);
......@@ -8627,7 +8628,7 @@ x_io_error_quitter (Display *display)
snprintf (buf, sizeof buf, "Connection lost to X server `%s'",
DisplayString (display));
x_connection_closed (display, buf);
x_connection_closed (display, buf, true);
return 0;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment