changeset 106290:8671036bedc4

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.
author Jan Djärv <jan.h.d@swipnet.se>
date Fri, 27 Nov 2009 17:27:04 +0000
parents c3a33227027b
children df75422e3816
files src/ChangeLog src/frame.c src/xftfont.c src/xterm.c
diffstat 4 files changed, 23 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Fri Nov 27 16:38:57 2009 +0000
+++ b/src/ChangeLog	Fri Nov 27 17:27:04 2009 +0000
@@ -1,5 +1,14 @@
 2009-11-27  Jan Djärv  <jan.h.d@swipnet.se>
 
+	* 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  <dann@ics.uci.edu>
--- a/src/frame.c	Fri Nov 27 16:38:57 2009 +0000
+++ b/src/frame.c	Fri Nov 27 17:27:04 2009 +0000
@@ -4377,6 +4377,9 @@
 {
   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 @@
   /* 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)
--- a/src/xftfont.c	Fri Nov 27 16:38:57 2009 +0000
+++ b/src/xftfont.c	Fri Nov 27 17:27:04 2009 +0000
@@ -668,7 +668,12 @@
 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)
     {
--- a/src/xterm.c	Fri Nov 27 16:38:57 2009 +0000
+++ b/src/xterm.c	Fri Nov 27 17:27:04 2009 +0000
@@ -10747,6 +10747,8 @@
 #endif /* ! USE_GTK */
     }
 
+  /* Mark as dead. */
+  dpyinfo->display = NULL;
   x_delete_display (dpyinfo);
   UNBLOCK_INPUT;
 }