Subject: bug#39977: 28.0.50; Unhelpful stack trace

From: Eli Zaretskii <[email-masked]>
Date: Tue, 17 Mar 2020 17:51:37 +0200

> Cc: [email-masked], [email-masked]
> From: martin rudalics <[email-masked]>
> Date: Tue, 17 Mar 2020 10:38:11 +0100
> 
>  > Why does it matter which SELECTED_FRAME crashes?
> 
> Because the next crash may happen at some time in the future.  Why not
> cure the first crash we have right away?

If we can cure it, sure.  But I don't yet see what kind of cure are
you suggesting.  And in any case, the cure is not in SELECTED_FRAME.

>  >>   >> As far as frame.c is concerned, it should do something like in the
>  >>   >> attached patch.
>  >>   >
>  >>   > We cannot punt like that in the display engine.
>  >>
>  >> Why not?
>  >
>  > Because we must have a frame that we were supposed to redisplay.
> 
> Either we are miscommunicating or I' m just dumb.  I would in no way
> restrict the display engine in choosing whatever live frame it wants to
> redisplay.

The original crash, and the crash you reported a couple of messages
upthread, are both in redisplay, though.  So I'm looking for a
solution to those.  Assigning some arbitrary value to a local variable
and/or switching to a different frame can be such solutions, albeit
not optimal ones; the changes you propose for frame.c cannot.

So I'm still unsure what exactly would you propose for the display
engine to do when it needs to examine the selected frame and discovers
that this frame is invalid.

>  > The display engine doesn't select frames to show them to the user, it
>  > selects them to redraw their windows.  So the considerations what to
>  > do in this case are different from those we need to consider when the
>  > user selects a frame.
> 
> As I said above: This is not about the frame its windows it has to
> redraw.  It's about the display engine trying to select a frame after
> it has redrawn (parts of) another frame's windows.

The display engine selects a frame because it needs to display
something related to that frame.  If it cannot select it, it should do
something about that, not just punt.

> :eval deleted the frame being displayed
> 
> So the display engine is, in principle, aware of one incarnation of the
> problem - the one where an :eval tries to delete under its feet the
> frame it currently tries to redraw and the comment correctly says that
> 
>    This is a nonsensical thing to do,
>    and signaling an error from redisplay might be
>    dangerous, but we cannot continue with an invalid frame.

You are proposing that we find all the places where SELECTED_FRAME is
used and fix them one by one?  I thought it could be better to fix
them all at once as part of SELECTED_FRAME.