Subject: bug#39977: 28.0.50; Unhelpful stack trace

From: martin rudalics <[email-masked]>
Date: Fri, 13 Mar 2020 17:28:53 +0100

> Martin, any thoughts or comments about this?

The selected frame must be invariantly live.  Madhu, could you find out
why we apparently manage to return from delete_frame in frame.c without
selecting another frame?

The dividing area is the part written as

   /* At this point, we are committed to deleting the frame.
      There is no more chance for errors to prevent it.  */
   minibuffer_selected = EQ (minibuf_window, selected_window);
   sf = SELECTED_FRAME ();
   /* Don't let the frame remain selected.  */
   if (f == sf)

starting around line 2012 in delete_frame.  Put a breakpoint anywhere
there and run your sly function.  If the (f == sf) check is not true, we
are lost.  Otherwise, try to step through the following FOR_EACH_FRAME
and tell us why it doesn't break out of that loop (and the subsequent
one).  It requires a bit of intuition, but since you probably will not
have more than one frame you should be able to find out quickly.

Other than that I cannot imagine what could have gone wrong here and/or
how to test this.  In either case sf = NULL; is not TRT but I think you
are aware of that.

martin