Subject: bug#73838: 31.0.50; Problems in note_mouse_highlight if -nw

From: Eli Zaretskii <[email-masked]>
Date: Thu, 17 Oct 2024 07:06:33 +0300

> From: Gerd Möllmann <[email-masked]>
> Cc: [email-masked]
> Date: Wed, 16 Oct 2024 21:03:15 +0200
> 
> > Thus, IMO your suggestion is in a sense a step back, because it
> > assumes that TTY frames can never have these decorations and can never
> > have different cursor types. So my suggestion would be to do the
> > opposite: understand why FRAME_OUTPUT_DATA segfaults when dereferenced
> > on TTY frames, and fix that so that it doesn't.
> 
> But the current situation is that we follow from the presence of an
> internal border that it's a window system frame. We're using
> FRAME_OUTPUT_DATA. If that would segv it would be a good thing. It
> doesn't do that, it just silently accesses some unrelated memory (in my
> case this is equivalent to casting the actual output_data contents to
> (struct ns_output *) regardless of what it actually is.
> 
> I've just dragged the FRAME_WINDOW_P out of this stuff because the
> whole if-statement is concerned with cursor = ... using FRAME_OUTPUT_DATA.

My suggestion is to extend 'struct tty_display_info' so that
FRAME_OUTPUT_DATA on TTY frames will not access unrelated memory, when
these macros/inline functions are called.  Alternatively, we could have
the macros/functions (FRAME_INTERNAL_BORDER etc.) test for TTY frame
and DTRT.