Subject: Re: bug#18136: 24.4.50; crash in redisplay when calling load-theme

From: martin rudalics <[email-masked]>
Date: Tue, 29 Jul 2014 12:44:22 +0200

>> (gdb) xbacktrace al (C function)" (0xbbeea0)
 >> "redisplay_internal (C function)" (0xbbeea0)
 >> (gdb) bt
 >> #0  terminate_due_to_signal (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=40) at emacs.c:359
 >> #1  0x00000000004fe2e3 in emacs_abort () at sysdep.c:2198
 >> #2  0x00000000004a81c1 in cmcheckmagic (tty=0x13d82a0) at cm.c:120
 >> #3  0x0000000000418225 in update_frame_line (f=f@entry=0xc0ab08, vpos=50) at dispnew.c:4839
 >
 > Martin, this is because of this change in the call to
 > change_frame_size by init_display:
 >
 >    @@ -6171,7 +6069,8 @@ init_display (void)
 >         t->display_info.tty->top_frame = selected_frame;
 >         change_frame_size (XFRAME (selected_frame),
 > 			  FrameCols (t->display_info.tty),
 >    -                       FrameRows (t->display_info.tty), 0, 0, 1, 0);
 >    +                       FrameRows (t->display_info.tty)
 >    +                      - FRAME_MENU_BAR_LINES (f), 0, 0, 1, 0);
 >
 > change_frame_size_1 then calls adjust_frame_size with the value one
 > less than the terminal height, and adjust_frame_size plugs that value
 > into FrameRows:
 >
 >        if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
 > 	FrameRows (FRAME_TTY (f)) = new_lines;
 >
 > This lies to Emacs about the terminal height, and cmcheckmagic catches
 > that.
 >
 > I don't understand why you subtract FRAME_MENU_BAR_LINES, that sounds
 > wrong at least for TTY frames.  (We could add that back inside
 > adjust_frame_size, but it's IMO a bad idea to spread this non-trivial
 > logic between 2 functions.)

All functions like change_frame_size or adjust_frame_size now expect the
frame's text height as argument and menu and tool bars should not be
part of it.  I was expecting some breakage of this approach for TTY
frames because I didn't fully understand the logic of how frames get
assigned sizes.  Probably this assignment

       if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
	FrameCols (FRAME_TTY (f)) = new_cols;

is completely misplaced and should be either removed or inhibited when
called from change_frame_size_1, that is when INHIBIT equals 5.  Can you
tell me what this assignment is for?

martin