changeset 27046:872992e41f21

(IT_update_begin): Don't dereference members of struct window for deleted windows.
author Eli Zaretskii <eliz@gnu.org>
date Thu, 30 Dec 1999 14:13:13 +0000
parents e0b241ae1977
children 936229b925c8
files src/msdos.c
diffstat 1 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/msdos.c	Thu Dec 30 12:32:41 1999 +0000
+++ b/src/msdos.c	Thu Dec 30 14:13:13 1999 +0000
@@ -1711,16 +1711,25 @@
 	 Likewise, don't do anything if the frame is garbaged;
 	 in that case, the frame's current matrix that we would use
 	 is all wrong, and we will redisplay that line anyway.  */
-      if (!NILP (display_info->mouse_face_window))
+      if (!NILP (display_info->mouse_face_window)
+	  && WINDOWP (display_info->mouse_face_window))
 	{
 	  struct window *w = XWINDOW (display_info->mouse_face_window);
 	  int i;
 
-	  for (i = 0; i < w->desired_matrix->nrows; ++i)
-	    if (MATRIX_ROW_ENABLED_P (w->desired_matrix, i))
-	      break;
-
-	  if (i < w->desired_matrix->nrows)
+	  /* If the mouse highlight is in the window that was deleted
+	     (e.g., if it was popped by completion), clear highlight
+	     unconditionally.  */
+	  if (NILP (w->buffer))
+	    display_info->mouse_face_window = Qnil;
+	  else
+	    {
+	      for (i = 0; i < w->desired_matrix->nrows; ++i)
+		if (MATRIX_ROW_ENABLED_P (w->desired_matrix, i))
+		  break;
+	    }
+
+	  if (NILP (w->buffer) || i < w->desired_matrix->nrows)
 	    clear_mouse_face (display_info);
 	}
     }