From 8ccb9a546b981224e8e354ea2a818541e6e9b610 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 30 Dec 1999 14:14:38 +0000 Subject: [PATCH] (IT_update_begin): Don't dereference members of struct window for deleted windows. --- src/ChangeLog | 5 +++++ src/msdos.c | 19 ++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 413db7655c1..9c4ce9ec50b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +1999-12-30 Eli Zaretskii + + * msdos.c (IT_update_begin): Don't dereference members of struct + window for deleted windows. + 1999-12-30 Gerd Moellmann * abbrev.c (Fexpand_abbrev): If expanding an abbrev which has only diff --git a/src/msdos.c b/src/msdos.c index cd969127fe1..3cd0d7e5a4e 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -1711,16 +1711,25 @@ IT_update_begin (struct frame *f) 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 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 (i < w->desired_matrix->nrows) + if (NILP (w->buffer) || i < w->desired_matrix->nrows) clear_mouse_face (display_info); } } -- 2.39.5