GNU bug report logs - #18422
24.3.93; Assertion violation when resizing mini-window on a TTY

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Sun, 7 Sep 2014 19:24:01 UTC

Severity: normal

Found in version 24.3.93

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.93; Assertion violation when resizing mini-window on a TTY
Date: Sun, 07 Sep 2014 22:23:10 +0300
The following recipe causes an assertion violation on MS-Windows (I
don't have access to a Unix TTY with a mouse to try there):

  emacs -Q -nw
  M-: (setq resize-mini-windows nil) RET

  Drag the mode line with the mouse -- you get assertion violation:

    dispnew.c:684: Emacs fatal error: assertion failed: start >= 0 && start < matrix->nrows

The immediate reason for this is that clear_glyph_matrix_rows is
called with both start = 0 and end = 0.  But the root cause is that
Emacs thinks the mini-buffer window has a zero height.  This comes
from here:

  static int
  required_matrix_height (struct window *w)
  {
  #ifdef HAVE_WINDOW_SYSTEM
    struct frame *f = XFRAME (w->frame);

    if (FRAME_WINDOW_P (f))
      {
	int ch_height = FRAME_SMALLEST_FONT_HEIGHT (f);
	int window_pixel_height = window_box_height (w) + eabs (w->vscroll);

	return (((window_pixel_height + ch_height - 1)
		 / ch_height) * w->nrows_scale_factor
		/* One partially visible line at the top and
		   bottom of the window.  */
		+ 2
		/* 2 for header and mode line.  */
		+ 2);
      }
  #endif /* HAVE_WINDOW_SYSTEM */

    return WINDOW_TOTAL_LINES (w); <<<<<<<<<<<<<<<<<<<<<
  }

The total_lines value is zero.  It turns out that total_lines is
assigned the zero value in resize-mini-window-internal:

      w->total_lines = XFASTINT (w->new_total);  <<<<<<<<<<<<<<
      w->pixel_height = XFASTINT (w->new_pixel);

and w->new_total is zero because no one set it to any other value.  In
window--resize-mini-window we do this:

	(window--resize-this-window root (- delta) nil nil t)
	(set-window-new-pixel window (+ height delta))
	;; The following routine catches the case where we want to resize
	;; a minibuffer-only frame.
	(when (resize-mini-window-internal window)
	  (window--pixel-to-total frame)

So by the time resize-mini-window-internal is called, w->new_pixel is
already set as appropriate, but w->new_total is set only after the
call to resize-mini-window-internal returns.

Now, on GUI frames this problem doesn't happen, because, as seen from
required_matrix_height above, total_lines is never used there to
determine the matrix dimensions.  Instead, GUI frames calculate their
height in pixels, which is already set by this time.

I can fix this problem with the following semi-kludgey change (which
will need a comment to explain the above, if and when it's committed):

=== modified file 'src/window.c'
--- src/window.c	2014-08-09 11:12:45 +0000
+++ src/window.c	2014-09-07 19:19:19 +0000
@@ -4807,6 +4807,8 @@ DEFUN ("resize-mini-window-internal", Fr
       w->total_lines = XFASTINT (w->new_total);
       w->top_line = r->top_line + r->total_lines;
       w->pixel_height = XFASTINT (w->new_pixel);
+      if (!FRAME_WINDOW_P (f))
+	w->total_lines = w->pixel_height;
       w->pixel_top = r->pixel_top + r->pixel_height;
 
       fset_redisplay (f);


Is this the right fix?


In GNU Emacs 24.3.93.28 (i686-pc-mingw32)
 of 2014-09-07 on HOME-C4E4A596F7
Repository revision: 117483 monnier <at> iro.umontreal.ca-20140905173712-p7fyv6iaijldb29c
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --prefix=/d/usr --enable-checking=yes,glyphs 'CFLAGS=-O0
 -g3''

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1255

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r e p o r t - e m a c s - b u g <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util help-fns mail-prsvr mail-utils time-date tooltip electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp
w32-common-fns disp-table w32-win w32-vars tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register
page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process w32notify w32
multi-tty emacs)

Memory information:
((conses 8 74225 7254)
 (symbols 32 17536 0)
 (miscs 32 33 97)
 (strings 16 10776 4344)
 (string-bytes 1 269292)
 (vectors 8 9555)
 (vector-slots 4 384789 5962)
 (floats 8 57 68)
 (intervals 28 238 95)
 (buffers 508 11))




This bug report was last modified 10 years and 250 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.