Subject: Re: bug#39977: 28.0.50; Unhelpful stack trace

From: martin rudalics <[email-masked]>
Date: Sat, 14 Mar 2020 19:55:34 +0100

Maybe the following two changes would not harm:

(1) In fast_set_selected_frame check whether FRAME is live before doing
     selected_frame = frame;

(2) In display_mode_lines check whether new_frame is live before doing

     selected_frame = new_frame;

     and maybe also for old_selected_frame before

     selected_frame = old_selected_frame;

Maybe display_mode_lines should better use

    record_unwind_protect (fast_set_selected_frame, selected_frame);

What was the rationale for protecting frame reselection when drawing the
tab bar or the tool bar and not protecting it when drawing mode lines?

I have no idea whether these could help in any way but since we are in
redisplay and the selected frame has become dead all of a sudden ...

Another point is obviously the

       do_switch_frame (frame1, 0, 1, Qnil);
       sf = SELECTED_FRAME ();

combination in delete_frame itself.  If frame1 is dead, we select the
frame we are about to delete.  But this should not produce the abort at
hand since the assignment to selected_frame happens in do_switch_frame.
Guarding that assignment would not harm either and then we're done IMO.
WDYT?

martin