From: Jan Djärv Date: Fri, 27 Nov 2009 17:27:04 +0000 (+0000) Subject: Don't crash if an X terminal is deleted with force == t. X-Git-Tag: emacs-pretest-23.1.90~193 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ece2d4ed181649ebdac464f8149527a9ce75d4ad;p=emacs.git Don't crash if an X terminal is deleted with force == t. * xftfont.c (xftfont_end_for_frame): Just return if dpyinfo->display is NULL. * xterm.c (x_delete_terminal): Set dpyinfo->display to NULL. * frame.c (frame_make_pointer_invisible) (frame_make_pointer_visible): Just return if there isn't any selected frame. --- diff --git a/src/ChangeLog b/src/ChangeLog index 495e712c646..5d385e6b412 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,14 @@ 2009-11-27 Jan Djärv + * xftfont.c (xftfont_end_for_frame): Just return if dpyinfo->display + is NULL. + + * xterm.c (x_delete_terminal): Set dpyinfo->display to NULL. + + * frame.c (frame_make_pointer_invisible) + (frame_make_pointer_visible): Just return if there isn't any selected + frame. + * search.c (simple_search): Remove warning by making *p const. 2009-11-26 Dan Nicolaescu diff --git a/src/frame.c b/src/frame.c index 4a9d30dd215..1475eb68fb6 100644 --- a/src/frame.c +++ b/src/frame.c @@ -4377,6 +4377,9 @@ frame_make_pointer_invisible () { if (! NILP (Vmake_pointer_invisible)) { + if (!FRAMEP (selected_frame) || !FRAME_LIVE_P (XFRAME (selected_frame))) + return; + struct frame *f = SELECTED_FRAME (); if (f && !f->pointer_invisible && FRAME_TERMINAL (f)->toggle_invisible_pointer_hook) @@ -4394,6 +4397,9 @@ frame_make_pointer_visible () /* We don't check Vmake_pointer_invisible here in case the pointer was invisible when Vmake_pointer_invisible was set to nil. */ + if (!FRAMEP (selected_frame) || !FRAME_LIVE_P (XFRAME (selected_frame))) + return; + struct frame *f = SELECTED_FRAME (); if (f && f->pointer_invisible && f->mouse_moved && FRAME_TERMINAL (f)->toggle_invisible_pointer_hook) diff --git a/src/xftfont.c b/src/xftfont.c index d5ea4aa2ac3..e2819863f07 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -668,7 +668,12 @@ static int xftfont_end_for_frame (f) FRAME_PTR f; { - XftDraw *xft_draw = font_get_frame_data (f, &xftfont_driver); + XftDraw *xft_draw; + + /* Don't do anything if display is dead */ + if (FRAME_X_DISPLAY (f) == NULL) return 0; + + xft_draw = font_get_frame_data (f, &xftfont_driver); if (xft_draw) { diff --git a/src/xterm.c b/src/xterm.c index 94093bd3848..9feb6c8966a 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10747,6 +10747,8 @@ x_delete_terminal (struct terminal *terminal) #endif /* ! USE_GTK */ } + /* Mark as dead. */ + dpyinfo->display = NULL; x_delete_display (dpyinfo); UNBLOCK_INPUT; }