Subject: Re: bug#73022: 31.0.50; Crash in build_frame_matrix_from_leaf_window after C-x 2 and reducing terminal size

From: martin rudalics <[email-masked]>
Date: Sun, 8 Sep 2024 16:36:24 +0200

> We're dealing with two type of assertion violations / crashes / backtraces:
 > - in update_frame_line, that causes chcheckmagic to fail
 > - in build_frame_matrix_from_leaf_window, assertion violation
 >
 > With the same build I mentioned in the top post (that is, without any
 > code change), I can see both, after following the same instructions I
 > posted.
 > The update_frame_line happens much more frequently, therefore I
 > thought that the update_frame_line was fixed in 71289; but it's not: I
 > just reproduced the update_frame_line issue.

Good to know.

 > So you can't be sure that the original assertion violation is gone.

Right.

 > Your build may have crashed with the update_frame_line crash, before
 > reaching the build_frame_matrix_from_leaf_window crash.

Right again.  But I think that with my initial patch, the likeliness of
the later has decreased.

 > The best would be to solve both crashes :-)
 >
 > I don't know whether both crashes are related.

They are both caused by shrinking the frame size to something Emacs
doesn't like.  Note the

       if (width > 5 && height > 2)

check in handle_window_change_signal and the

   /* Don't allow too small height of text-mode frames, or else cm.c
      might abort in cmcheckmagic.  */
   if ((FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) && NILP (horizontal))
     {
       int min_height = (FRAME_MENU_BAR_LINES (f)
			+ FRAME_TAB_BAR_LINES (f)
			+ FRAME_WANTS_MODELINE_P (f)
			+ 2);	/* one text line and one echo-area line */

       if (retval < min_height)
	retval = min_height;
     }

in frame_windows_min_size.  People always were aware of the problem but
with split windows these values are of no use.

martin