Subject: bug#60096: 29.0.60; Crash in format_mode_line_unwind_data

From: martin rudalics <[email-masked]>
Date: Sat, 17 Dec 2022 10:17:00 +0100

> Basically, set-window-configuration was called in a situation where it
 > has only one valid buffer to play with, which is tough for its logic
 > and the various other functions it invokes.  The result was a bunch of
 > bad windows with nil as their buffer.

If a live window has nil as its buffer, next redisplay will reliably
crash Emacs anyway.  So this

       /* We may have deleted windows above.  Then again, maybe we
	 haven't: the functions we call to maybe delete windows can
	 decide a window cannot be deleted.  Force recalculation of
	 Vwindow_list next time it is needed, to make sure stale
	 windows with no buffers don't escape into the wild, which
	 will cause crashes elsewhere.  */
       Vwindow_list = Qnil;

should not be needed.  Otherwise we'd have been in serious trouble ever
since Vwindow_list was added.  The earlier call

       delete_all_child_windows (FRAME_ROOT_WINDOW (f));

should have reliably reset Vwindow_list to nil.

martin