emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 85b0587a93: Avoid assertion violations in matrix_row


From: Eli Zaretskii
Subject: master 85b0587a93: Avoid assertion violations in matrix_row
Date: Wed, 9 Nov 2022 09:26:04 -0500 (EST)

branch: master
commit 85b0587a93bdb80c4c304a39cb5ffd3600c95a16
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Avoid assertion violations in matrix_row
    
    * src/xdisp.c (cursor_in_mouse_face_p): Avoid rare assertion
    violations when the cursor's VPOS winds up being invalid for the
    window.  (Bug#59147)
---
 src/xdisp.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 95da704a07..f6a279636a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -33564,8 +33564,14 @@ coords_in_mouse_face_p (struct window *w, int hpos, 
int vpos)
 bool
 cursor_in_mouse_face_p (struct window *w)
 {
-  int hpos = w->phys_cursor.hpos;
   int vpos = w->phys_cursor.vpos;
+
+  /* If the cursor is outside the matrix glyph rows, it cannot be
+     within the mouse face.  */
+  if (!(0 <= vpos && vpos < w->current_matrix->nrows))
+    return false;
+
+  int hpos = w->phys_cursor.hpos;
   struct glyph_row *row = MATRIX_ROW (w->current_matrix, vpos);
 
   /* When the window is hscrolled, cursor hpos can legitimately be out



reply via email to

[Prev in Thread] Current Thread [Next in Thread]