From 9341956c8240e5552e27d6e3d67990d824c632b2 Mon Sep 17 00:00:00 2001 From: Jan D Date: Thu, 14 May 2015 16:21:02 +0200 Subject: 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. --- src/xterm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/xterm.c') diff --git a/src/xterm.c b/src/xterm.c index d9032fa5a14..9616dab8648 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -259,7 +259,7 @@ static int x_dispatch_event (XEvent *, Display *); #endif /* 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) dpyinfo->reference_count++; dpyinfo->terminal->reference_count++; } + 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; } -- cgit v1.2.1 From c9c4708ed47b18987940a71b98eb9873150d2b95 Mon Sep 17 00:00:00 2001 From: Jan D Date: Sun, 17 May 2015 11:30:09 +0200 Subject: Add comment that x_shift_glyphs_for_insert is never called. * xterm.c (x_shift_glyphs_for_insert, x_redisplay_interface): Add comment that this function is never called. --- src/xterm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/xterm.c') diff --git a/src/xterm.c b/src/xterm.c index 9616dab8648..ad2bef9f1f9 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2896,6 +2896,9 @@ x_draw_glyph_string (struct glyph_string *s) static void x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, int shift_by) { +/* Never called on a GUI frame, see + http://lists.gnu.org/archive/html/emacs-devel/2015-05/msg00456.html +*/ XCopyArea (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_WINDOW (f), f->output_data.x->normal_gc, x, y, width, height, @@ -11449,7 +11452,7 @@ static struct redisplay_interface x_redisplay_interface = x_draw_window_cursor, x_draw_vertical_window_border, x_draw_window_divider, - x_shift_glyphs_for_insert, + x_shift_glyphs_for_insert, /* Never called, se comment in function. */ x_show_hourglass, x_hide_hourglass }; -- cgit v1.2.1