Subject: Re: bug#70385: Crash in note_fringe_highlight

From: Po Lu <[email-masked]>
Date: Mon, 15 Apr 2024 19:57:44 +0800

Eli Zaretskii <[email-masked]> writes:

> Any reason you didn't include w->window_end_valid in the condition,
> like we do for mouse-highlight?

This wasn't necessary to fix the crash for me.

> I'd like in general to have the same conditions, to avoid having
> people wonder what they miss when they read this code.

Your wish is my command... :-)

I suspect it might fix the Bjorn's crash also.  Bjorn, please try:

diff --git a/src/xdisp.c b/src/xdisp.c
index d984c12d1aa..51f6b1efd69 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -35771,9 +35771,10 @@ note_fringe_highlight (struct frame *f, Lisp_Object window, int x, int y,
 
   /* Don't access the TEXT_AREA of a row that does not display text, or
      when the window is outdated.  (bug#70385) */
-  if (window_outdated (w)
-      || !MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->current_matrix,
-						  vpos)))
+  if ((window_outdated (w)
+       || !MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->current_matrix,
+						   vpos)))
+      && w->window_end_valid)
     return;
 
   /* Get to the first glyph of a text row based on the vertical position