unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#4534: assertion failure at window.c:grow_mini_window
@ 2009-09-23  3:02 ` Juanma Barranquero
  2009-09-23  7:28   ` martin rudalics
  2009-10-26 10:10   ` bug#4534: marked as done (assertion failure at window.c:grow_mini_window) Emacs bug Tracking System
  0 siblings, 2 replies; 27+ messages in thread
From: Juanma Barranquero @ 2009-09-23  3:02 UTC (permalink / raw)
  To: Emacs Bug Tracker

[-- Attachment #1: Type: text/plain, Size: 4786 bytes --]

GNU Emacs 23.1.50.1 (i386-mingw-nt5.1.2600) of 2009-09-22 on LEKTU
Compiled with gcc (4.3.3-tdm-1-dw2 mingw32) 4.3.3-dw2

I put the attached files into directory C:\temp, including the file test.el:

  (setq resize-mini-windows t)
  (setq ido-enable-flex-matching t)
  (setq ido-max-prospects 14)
  (ido-mode 1)

Then,

   emacs -Q -l c:/temp/test.el
   C-x C-f c:/temp/testfile <TAB> 3 <TAB> 7

Emacs aborts. (Note: As the failure depends on the number of lines in
the minibuffer, tweaking `ido-max-prospects' and/or adding more files
to the directory may be necessary to reproduce the bug.)

The xassert (delta >= 0) at the start of window.c:grow_mini_window
fails, because delta == -1. In resize_mini_window, the call to
xdisp.c:grow_mini_window has height == 5 and WINDOW_TOTAL_LINES (w) ==
6.

    Juanma



Breakpoint 1, w32_abort () at w32fns.c:7344
7344      button = MessageBox (NULL,
(gdb) bt
#0  w32_abort () at w32fns.c:7344
#1  0x011b929c in grow_mini_window (w=0x2f9ec00, delta=-1) at window.c:4637
#2  0x0106d122 in resize_mini_window (w=0x2f9ec00, exact_p=0) at xdisp.c:8809
#3  0x01075952 in redisplay_internal (preserve_echo_area=0) at xdisp.c:11536
#4  0x01073682 in redisplay () at xdisp.c:11031
#5  0x0100c78b in read_char (commandflag=1, nmaps=3, maps=0x82e1e0,
prev_event=48273409, used_mouse_menu=0x82e3c4, end_time=0x0)
    at keyboard.c:2707
#6  0x0101eb23 in read_key_sequence (keybuf=0x82e60c, bufsize=30,
prompt=48273409, dont_downcase_last=0, can_return_switch_frame=1,
    fix_current_buffer=1) at keyboard.c:9464
#7  0x01007a9a in command_loop_1 () at keyboard.c:1640
#8  0x01039cb2 in internal_condition_case (bfun=0x1007276
<command_loop_1>, handlers=48337089, hfun=0x10069ec <cmd_error>) at
eval.c:1513
#9  0x01006e85 in command_loop_2 () at keyboard.c:1357
#10 0x0103970b in internal_catch (tag=48447137, func=0x1006e65
<command_loop_2>, arg=48273409) at eval.c:1249
#11 0x01006dee in command_loop () at keyboard.c:1322
#12 0x01006143 in recursive_edit_1 () at keyboard.c:951
#13 0x0118feae in read_minibuf (map=52443485, initial=48273409,
prompt=49230995, backup_n=0, expflag=0, histvar=54300225, histpos=0,
    defalt=48273409, allow_props=0, inherit_input_method=0) at minibuf.c:739
#14 0x01193225 in Fcompleting_read (prompt=49230995,
collection=48635549, predicate=48273409, require_match=48273409,
    initial_input=48273409, hist=54300225, def=48273409,
inherit_input_method=48273409) at minibuf.c:1823
#15 0x0103df96 in Ffuncall (nargs=7, args=0x82eab0) at eval.c:3076
#16 0x011df195 in Fbyte_code (bytestr=51766515, vector=49979972,
maxdepth=56) at bytecode.c:678
#17 0x0103beb5 in Feval (form=48635773) at eval.c:2382
#18 0x0103970b in internal_catch (tag=49728209, func=0x103b477
<Feval>, arg=48635773) at eval.c:1249
#19 0x011dfdba in Fbyte_code (bytestr=54186131, vector=52804612,
maxdepth=176) at bytecode.c:853
#20 0x0103e7a9 in funcall_lambda (fun=50993028, nargs=6,
arg_vector=0x82f1d4) at eval.c:3232
#21 0x0103e005 in Ffuncall (nargs=7, args=0x82f1d0) at eval.c:3091
#22 0x011df195 in Fbyte_code (bytestr=51674739, vector=50023940,
maxdepth=64) at bytecode.c:678
#23 0x0103e7a9 in funcall_lambda (fun=50992164, nargs=1,
arg_vector=0x82f4f4) at eval.c:3232
#24 0x0103e005 in Ffuncall (nargs=2, args=0x82f4f0) at eval.c:3091
#25 0x011df195 in Fbyte_code (bytestr=49722835, vector=54198164,
maxdepth=16) at bytecode.c:678
#26 0x0103e7a9 in funcall_lambda (fun=50348772, nargs=0,
arg_vector=0x82f834) at eval.c:3232
#27 0x0103e005 in Ffuncall (nargs=1, args=0x82f830) at eval.c:3091
#28 0x0103d017 in apply1 (fn=49253217, arg=48273409) at eval.c:2786
#29 0x011e2be5 in Fcall_interactively (function=49253217,
record_flag=48273409, keys=48306948) at callint.c:395
#30 0x0103dbdc in Ffuncall (nargs=4, args=0x82faf8) at eval.c:3051
#31 0x0103d119 in call3 (fn=48471425, arg1=49253217, arg2=48273409,
arg3=48273409) at eval.c:2871
#32 0x01023a41 in Fcommand_execute (cmd=49253217,
record_flag=48273409, keys=48273409, special=48273409) at
keyboard.c:10453
#33 0x0100a993 in command_loop_1 () at keyboard.c:1901
#34 0x01039cb2 in internal_condition_case (bfun=0x1007276
<command_loop_1>, handlers=48337089, hfun=0x10069ec <cmd_error>) at
eval.c:1513
#35 0x01006e85 in command_loop_2 () at keyboard.c:1357
#36 0x0103970b in internal_catch (tag=48333209, func=0x1006e65
<command_loop_2>, arg=48273409) at eval.c:1249
#37 0x01006e3c in command_loop () at keyboard.c:1336
#38 0x01006143 in recursive_edit_1 () at keyboard.c:951
#39 0x01006618 in Frecursive_edit () at keyboard.c:1013
#40 0x01002a8d in main (argc=4, argv=0xa92840) at emacs.c:1827

Lisp Backtrace:
"completing-read" (0x82eab4)
"byte-code" (0x82ed40)
"ido-read-internal" (0x82f1d4)
"ido-file-internal" (0x82f4f4)
"ido-find-file" (0x82f834)
"call-interactively" (0x82fafc)
(gdb)

[-- Attachment #2: bugdata.zip --]
[-- Type: application/zip, Size: 10130 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-23  3:02 ` bug#4534: assertion failure at window.c:grow_mini_window Juanma Barranquero
@ 2009-09-23  7:28   ` martin rudalics
  2009-09-23  9:50     ` Juanma Barranquero
  2009-10-26 10:10   ` bug#4534: marked as done (assertion failure at window.c:grow_mini_window) Emacs bug Tracking System
  1 sibling, 1 reply; 27+ messages in thread
From: martin rudalics @ 2009-09-23  7:28 UTC (permalink / raw)
  To: Juanma Barranquero, 4534

 > I put the attached files into directory C:\temp, including the file test.el:
 >
 >   (setq resize-mini-windows t)
 >   (setq ido-enable-flex-matching t)
 >   (setq ido-max-prospects 14)
 >   (ido-mode 1)
 >
 > Then,
 >
 >    emacs -Q -l c:/temp/test.el
 >    C-x C-f c:/temp/testfile <TAB> 3 <TAB> 7
 >
 > Emacs aborts. (Note: As the failure depends on the number of lines in
 > the minibuffer, tweaking `ido-max-prospects' and/or adding more files
 > to the directory may be necessary to reproduce the bug.)
 >
 > The xassert (delta >= 0) at the start of window.c:grow_mini_window
 > fails, because delta == -1. In resize_mini_window, the call to
 > xdisp.c:grow_mini_window has height == 5 and WINDOW_TOTAL_LINES (w) ==
 > 6.
 >
 >     Juanma
 >
 >
 >
 > Breakpoint 1, w32_abort () at w32fns.c:7344
 > 7344      button = MessageBox (NULL,
 > (gdb) bt
 > #0  w32_abort () at w32fns.c:7344
 > #1  0x011b929c in grow_mini_window (w=0x2f9ec00, delta=-1) at window.c:4637
 > #2  0x0106d122 in resize_mini_window (w=0x2f9ec00, exact_p=0) at xdisp.c:8809
...

The following part in `resize_mini_window' doesn't strike me as very
elegant in this respect:

	      if (height)
		{
		  freeze_window_starts (f, 1);
		  grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
		}

Does it cause the bug?  Just comment it out to check.

martin





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-23  7:28   ` martin rudalics
@ 2009-09-23  9:50     ` Juanma Barranquero
  2009-09-23 10:51       ` Juanma Barranquero
  2009-09-23 12:21       ` martin rudalics
  0 siblings, 2 replies; 27+ messages in thread
From: Juanma Barranquero @ 2009-09-23  9:50 UTC (permalink / raw)
  To: martin rudalics; +Cc: 4534

[-- Attachment #1: Type: text/plain, Size: 677 bytes --]

On Wed, Sep 23, 2009 at 09:28, martin rudalics <rudalics@gmx.at> wrote:

> The following part in `resize_mini_window' doesn't strike me as very
> elegant in this respect:
>
>              if (height)
>                {
>                  freeze_window_starts (f, 1);
>                  grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
>                }
>
> Does it cause the bug?  Just comment it out to check.

Well, yes, commenting that code out avoids the failure (which happens
in that call to grow_mini_window). But the point is, the miniwindow is
not shrunk as it should. See attached image.

    Juanma

[-- Attachment #2: bug-4534.png --]
[-- Type: image/png, Size: 10096 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-23  9:50     ` Juanma Barranquero
@ 2009-09-23 10:51       ` Juanma Barranquero
  2009-09-23 12:21         ` martin rudalics
  2009-09-23 12:21       ` martin rudalics
  1 sibling, 1 reply; 27+ messages in thread
From: Juanma Barranquero @ 2009-09-23 10:51 UTC (permalink / raw)
  To: martin rudalics; +Cc: 4534

FWIW, commenting out this chunk from shrink_mini_window, it works as expected.

    Juanma



diff --git a/src/window.c b/src/window.c
index 08fd8c8..c892436 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4677,17 +4677,18 @@ void
 shrink_mini_window (w)
      struct window *w;
 {
-  struct frame *f = XFRAME (w->frame);
-  struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f));
-
-  if (save_restore_orig_size (root, CHECK_ORIG_SIZES))
-    {
-      save_restore_orig_size (root, RESTORE_ORIG_SIZES);
-      adjust_glyphs (f);
-      FRAME_WINDOW_SIZES_CHANGED (f) = 1;
-      windows_or_buffers_changed = 1;
-    }
-  else if (XFASTINT (w->total_lines) > 1)
+  /* struct frame *f = XFRAME (w->frame); */
+  /* struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f)); */
+  /*  */
+  /* if (save_restore_orig_size (root, CHECK_ORIG_SIZES)) */
+  /*   { */
+  /*     save_restore_orig_size (root, RESTORE_ORIG_SIZES); */
+  /*     adjust_glyphs (f); */
+  /*     FRAME_WINDOW_SIZES_CHANGED (f) = 1; */
+  /*     windows_or_buffers_changed = 1; */
+  /*   } */
+  /* else if (XFASTINT (w->total_lines) > 1) */
+  if (XFASTINT (w->total_lines) > 1)
     {
       /* Distribute the additional lines of the mini-window
 	 among the other windows.  */





^ permalink raw reply related	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-23  9:50     ` Juanma Barranquero
  2009-09-23 10:51       ` Juanma Barranquero
@ 2009-09-23 12:21       ` martin rudalics
  2009-09-23 13:41         ` Juanma Barranquero
  1 sibling, 1 reply; 27+ messages in thread
From: martin rudalics @ 2009-09-23 12:21 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 4534

 > Well, yes, commenting that code out avoids the failure (which happens
 > in that call to grow_mini_window). But the point is, the miniwindow is
 > not shrunk as it should. See attached image.

Well that code was probably intended to serve some purpose ;-)  I just
wanted to spot the culprit.  Would writing

	      if (height > WINDOW_TOTAL_LINES (w))
		{
		  freeze_window_starts (f, 1);
		  grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
		}

instead do better?  I don't want to delve deeper into this because I'd
like to get rid of this weird height/position save/restore code soon.

martin





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-23 10:51       ` Juanma Barranquero
@ 2009-09-23 12:21         ` martin rudalics
  2009-09-23 13:42           ` Juanma Barranquero
  0 siblings, 1 reply; 27+ messages in thread
From: martin rudalics @ 2009-09-23 12:21 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 4534

 > FWIW, commenting out this chunk from shrink_mini_window, it works as expected.
 >
 >     Juanma
 >
 >
 >
 > diff --git a/src/window.c b/src/window.c
 > index 08fd8c8..c892436 100644
 > --- a/src/window.c
 > +++ b/src/window.c
 > @@ -4677,17 +4677,18 @@ void
 >  shrink_mini_window (w)
 >       struct window *w;
 >  {
 > -  struct frame *f = XFRAME (w->frame);
 > -  struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f));
 > -
 > -  if (save_restore_orig_size (root, CHECK_ORIG_SIZES))
 > -    {
 > -      save_restore_orig_size (root, RESTORE_ORIG_SIZES);
 > -      adjust_glyphs (f);
 > -      FRAME_WINDOW_SIZES_CHANGED (f) = 1;
 > -      windows_or_buffers_changed = 1;
 > -    }
 > -  else if (XFASTINT (w->total_lines) > 1)

This would make the whole save/restore code obsolete.  Unfortunately,
the resulting alternative (enlarge_window) is even worse because it
might delete windows (when it tries to enlarge them) :-(

martin





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-23 12:21       ` martin rudalics
@ 2009-09-23 13:41         ` Juanma Barranquero
  2009-09-24  6:49           ` martin rudalics
  0 siblings, 1 reply; 27+ messages in thread
From: Juanma Barranquero @ 2009-09-23 13:41 UTC (permalink / raw)
  To: martin rudalics; +Cc: 4534

On Wed, Sep 23, 2009 at 14:21, martin rudalics <rudalics@gmx.at> wrote:

> Would writing
>
>              if (height > WINDOW_TOTAL_LINES (w))
>                {
>                  freeze_window_starts (f, 1);
>                  grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
>                }
>
> instead do better?

In my case, height < WINDOW_TOTAL_LINES (w) at that point (that's what
triggers the xassert), so adding the above check works exactly like
removing the if() altogether: it does not crash, but it does not
shrink the minibuffer to 5 lines, which would be the correct height.

    Juanma





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-23 12:21         ` martin rudalics
@ 2009-09-23 13:42           ` Juanma Barranquero
  2009-09-24  6:49             ` martin rudalics
  0 siblings, 1 reply; 27+ messages in thread
From: Juanma Barranquero @ 2009-09-23 13:42 UTC (permalink / raw)
  To: martin rudalics; +Cc: 4534

On Wed, Sep 23, 2009 at 14:21, martin rudalics <rudalics@gmx.at> wrote:

> This would make the whole save/restore code obsolete.  Unfortunately,
> the resulting alternative (enlarge_window) is even worse because it
> might delete windows (when it tries to enlarge them) :-(

Hey, you're the expert :-)

I was merely pointing out that the save/restore code is doing the
wrong thing here.

    Juanma





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-23 13:42           ` Juanma Barranquero
@ 2009-09-24  6:49             ` martin rudalics
  0 siblings, 0 replies; 27+ messages in thread
From: martin rudalics @ 2009-09-24  6:49 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 4534

 > I was merely pointing out that the save/restore code is doing the
 > wrong thing here.

I see.  Perdona mi estupidez.

martin





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-23 13:41         ` Juanma Barranquero
@ 2009-09-24  6:49           ` martin rudalics
  2009-09-24 12:58             ` Juanma Barranquero
  0 siblings, 1 reply; 27+ messages in thread
From: martin rudalics @ 2009-09-24  6:49 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 4534

 >> Would writing
 >>
 >>              if (height > WINDOW_TOTAL_LINES (w))
 >>                {
 >>                  freeze_window_starts (f, 1);
 >>                  grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
 >>                }
 >>
 >> instead do better?
 >
 > In my case, height < WINDOW_TOTAL_LINES (w) at that point (that's what
 > triggers the xassert), so adding the above check works exactly like
 > removing the if() altogether: it does not crash, but it does not
 > shrink the minibuffer to 5 lines, which would be the correct height.

Seems I'm too silly to understand what's going on in resize_mini_window.
Apparently

       if (EQ (Vresize_mini_windows, Qgrow_only))
         ... fails so ...
       else
         ... gets executed ...
         {
           /* Always resize to exact size needed.  */
           if (height > WINDOW_TOTAL_LINES (w))
             ... fails again, so ...
           else if (height < WINDOW_TOTAL_LINES (w))
             ... we're here ...
             {
               int old_height = WINDOW_TOTAL_LINES (w);
               freeze_window_starts (f, 0);
               shrink_mini_window (w);
               ... should resize the mini_window down to one line ...

               if (height)
                 {
                   freeze_window_starts (f, 1);
		  ... and the following causes the assertion failure to
                       trigger because the second arguments gets less
                       than zero ...
		  grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
                 }

               window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
             }
         }

Now if I replace the check

               if (height)

by

               if (height > WINDOW_TOTAL_LINES (w))

I should be able to avoid the delta = -1 assertion failure in
grow_mini_window.  Can you confirm my reasoning so far?

The fact that `height' is something like zero or less seems to stem from
some miscalculation (probably caused by the line-wrapping part) earlier
in the code of resize_mini_window.  If that's so could you try to find
out why height is not at least one line?

martin





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-24  6:49           ` martin rudalics
@ 2009-09-24 12:58             ` Juanma Barranquero
  2009-09-24 15:32               ` martin rudalics
  2009-09-25  8:35               ` Eli Zaretskii
  0 siblings, 2 replies; 27+ messages in thread
From: Juanma Barranquero @ 2009-09-24 12:58 UTC (permalink / raw)
  To: martin rudalics; +Cc: 4534

On Thu, Sep 24, 2009 at 08:49, martin rudalics <rudalics@gmx.at> wrote:

>      if (EQ (Vresize_mini_windows, Qgrow_only))
>        ... fails so ...
>      else
>        ... gets executed ...
>        {
>          /* Always resize to exact size needed.  */
>          if (height > WINDOW_TOTAL_LINES (w))
>            ... fails again, so ...
>          else if (height < WINDOW_TOTAL_LINES (w))
>            ... we're here ...
>            {
>              int old_height = WINDOW_TOTAL_LINES (w);
>              freeze_window_starts (f, 0);
>              shrink_mini_window (w);
>              ... should resize the mini_window down to one line ...

That's exactly what happens, except that shrink_mini_window (w) does
*not* resize the miniwindow; it's still 6 lines height. So

>              if (height)
>                {
>                  freeze_window_starts (f, 1);
>                  ... and the following causes the assertion failure to
>                      trigger because the second arguments gets less
>                      than zero ...
>                  grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));

at this point, height == 5, WINDOW_TOTAL_LINES (w) == 6.

>                }
>
>              window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
>            }
>        }
>
> Now if I replace the check
>
>              if (height)
>
> by
>
>              if (height > WINDOW_TOTAL_LINES (w))
>
> I should be able to avoid the delta = -1 assertion failure in
> grow_mini_window.  Can you confirm my reasoning so far?

It's correct. Except that, as shrink_mini_window didn't shrink the
window, it remains at 6 lines.

> The fact that `height' is something like zero or less seems to stem from
> some miscalculation (probably caused by the line-wrapping part) earlier
> in the code of resize_mini_window.  If that's so could you try to find
> out why height is not at least one line?

I'm attaching the trace from inside shrink_mini_window. The call
happens just after I type '7'. At this moment, as said, the minibuffer
contains six lines of completion candidates, and the 7 reduces the
number of candidates so they fit in 5 lines.

If you need me to look into something specific that could help you
pinpoint the problem, just say so.

    Juanma



Breakpoint 3, shrink_mini_window (w=0x2fb1c00) at window.c:4680
4680      struct frame *f = XFRAME (w->frame);
(gdb) p *f
$1 = {
  size = 3053453312,
  next = 0x5b900313,
  name = 66312,
  icon_name = 65536,
  title = 0,
  focus_frame = 1588658176,
  root_window = -658373880,
  selected_window = -1241251100,
  minibuffer_window = 268698387,
  param_alist = 553976571,
  scroll_bars = 742,
  condemned_scroll_bars = 1588396032,
  menu_bar_items = -1940914176,
  face_alist = 357,
  menu_bar_vector = 279576576,
  buffer_predicate = 279576576,
  buffer_list = 0,
  buried_buffer_list = 1342177280,
  menu_bar_window = 525044,
  tool_bar_window = 524288,
  tool_bar_items = 4096,
  desired_tool_bar_string = 8519680,
  current_tool_bar_string = 1342193680,
  face_cache = 0x180308,
  menu_bar_items_used = 536870912,
  namebuf = 0xa2240010 <Address 0xa2240010 out of bounds>,
  current_pool = 0xa22402f5,
  desired_pool = 0xa22402f5,
  desired_matrix = 0xa22402f5,
  current_matrix = 0xa22402f5,
  glyphs_initialized_p = 1,
  resized_p = 0,
  force_flush_display_p = 1,
  default_face_done_p = 0,
  already_hscrolled_p = 1,
  updated_p = 1,
  minimize_tool_bar_window_p = 1,
  tool_bar_lines = -1574698251,
  n_tool_bar_rows = -1574698251,
  n_tool_bar_items = -1574698251,
  decode_mode_spec_buffer = 0xa22402f5 <Address 0xa22402f5 out of bounds>,
  insert_line_cost = 0xa22402f5,
  delete_line_cost = 0xa22402f5,
  insert_n_lines_cost = 0xa22402f5,
  delete_n_lines_cost = 0xa22402f5,
  text_lines = -1574698251,
  text_cols = -1574698251,
  total_lines = -1574698251,
  total_cols = -1574698251,
  new_text_lines = -1574698251,
  new_text_cols = -1574698251,
  left_pos = -1574698251,
  top_pos = -1574698251,
  pixel_height = -1574698251,
  pixel_width = -1574698251,
  resx = -3.2051845696591629e-144,
  resy = -3.2051845696591629e-144,
  x_pixels_diff = -1574698251,
  y_pixels_diff = -1574698251,
  win_gravity = -1574698251,
  size_hint_flags = -1574698251,
  border_width = -1574698251,
  internal_border_width = -1574698251,
  column_width = -1574698251,
  space_width = -1574698251,
  line_height = -1574698251,
  output_method = 2720269045,
  terminal = 0xa22402f5,
  output_data = {
    tty = 0xa22402f5,
    x = 0xa22402f5,
    w32 = 0xa22402f5,
    ns = 0xa22402f5,
    nothing = -1574698251
  },
  font_driver_list = 0xa22402f5,
  font_data_list = 0xa22402f5,
  fringe_cols = -1574698251,
  left_fringe_width = -1574698251,
  right_fringe_width = -1574698251,
  want_fullscreen = 2720269045,
  menu_bar_lines = -1574698251,
  external_menu_bar = 1,
  display_preempted = 0 '\0',
  visible = 1 '\001',
  iconified = 1 '\001',
  async_visible = 2 '\002',
  async_iconified = 36 '$',
  garbaged = -94 '\242',
  has_minibuffer = 1 '\001',
  wants_modeline = 0 '\0',
  can_have_scroll_bars = 2 '\002',
  auto_raise = 0 '\0',
  auto_lower = 0 '\0',
  no_split = 1 '\001',
  explicit_name = 0 '\0',
  window_sizes_changed = 0 '\0',
  mouse_moved = 1 '\001',
  pointer_invisible = 0 '\0',
  vertical_scroll_bar_type = 2720269045,
  desired_cursor = -1574698251,
  cursor_width = -1574698251,
  blink_off_cursor = -1574698251,
  blink_off_cursor_width = -1574698251,
  message_buf = 0xa22402f5 <Address 0xa22402f5 out of bounds>,
  scroll_bottom_vpos = -1574698251,
  config_scroll_bar_width = -1574698251,
  config_scroll_bar_cols = -1574698251,
  scroll_bar_actual_width = -1574698251,
  cost_calculation_baud_rate = -1574698251,
  alpha = {-3.2051845696591629e-144, -3.2051845696591629e-144},
  gamma = -3.2051845696591629e-144,
  extra_line_spacing = -1574698251,
  background_pixel = 2720269045,
  foreground_pixel = 2720269045
}
(gdb) n
4681      struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f));
(gdb) p *root
$2 = {
  size = 1073873018,
  vec_next = 0x3433200,
  frame = 55866552,
  mini_p = 365,
  next = 365,
  prev = 365,
  hchild = 365,
  vchild = 1668,
  parent = 77,
  left_col = 77,
  top_line = 0,
  total_lines = 17,
  total_cols = 28,
  buffer = 0,
  start = 74,
  pointm = 17,
  force_start = 55556516,
  optional_new_start = 50879400,
  hscroll = 20788139,
  min_hscroll = 51623432,
  use_time = 30,
  sequence_number = 30,
  temslot = 1,
  last_modified = 1,
  last_overlay_modified = 365,
  last_point = 365,
  last_had_star = 0,
  vertical_scroll_bar = 0,
  left_margin_cols = 0,
  right_margin_cols = 0,
  left_fringe_width = 0,
  right_fringe_width = 0,
  fringes_outside_margins = 0,
  scroll_bar_width = 0,
  vertical_scroll_bar_type = 0,
  last_mark_x = 0,
  last_mark_y = 16777216,
  window_end_pos = 48273409,
  window_end_vpos = 49329729,
  window_end_valid = 48273409,
  update_mode_line = 0,
  start_at_line_beg = 0,
  display_table = 0,
  dedicated = -1,
  base_line_number = 1,
  base_line_pos = 0,
  region_showing = 0,
  column_number_displayed = 0,
  redisplay_end_trigger = 48273456,
  resize_proportionally = 0,
  orig_total_lines = 0,
  orig_top_line = 321,
  window_parameters = 55653125,
  current_matrix = 0x347c2e3,
  desired_matrix = 0x2e09801,
  nrows_scale_factor = 49860659,
  ncols_scale_factor = 48273409,
  last_cursor = {
    x = 0,
    y = 48273409,
    hpos = 48273409,
    vpos = 50879186
  },
  cursor = {
    x = 54359045,
    y = 48273601,
    hpos = 48272499,
    vpos = 48628621
  },
  phys_cursor = {
    x = 48273409,
    y = 52445245,
    hpos = 49214980,
    vpos = 48300036
  },
  phys_cursor_type = 48303620,
  phys_cursor_width = 48273457,
  phys_cursor_ascent = 64,
  phys_cursor_height = 560,
  phys_cursor_on_p = 0,
  cursor_off_p = 0,
  last_cursor_off_p = 0,
  must_be_updated_p = 0,
  pseudo_window_p = 0,
  frozen_window_start_p = 0,
  vscroll = 48273409,
  window_end_bytepos = 48273409
}
(gdb) n
4683      if (save_restore_orig_size (root, CHECK_ORIG_SIZES))
(gdb) n
4685          save_restore_orig_size (root, RESTORE_ORIG_SIZES);
(gdb) p *root
$3 = {
  size = 1073745971,
  vec_next = 0x300f0c0,
  frame = 50008068,
  mini_p = 48273409,
  next = 50011140,
  prev = 48273409,
  hchild = 48273409,
  vchild = 50011652,
  parent = 48273409,
  left_col = 0,
  top_line = 24,
  total_lines = 264,
  total_cols = 680,
  buffer = 48273409,
  start = 48273409,
  pointm = 48273409,
  force_start = 48273409,
  optional_new_start = 48273409,
  hscroll = 0,
  min_hscroll = 0,
  use_time = 56,
  sequence_number = 48,
  temslot = 0,
  last_modified = 0,
  last_overlay_modified = 0,
  last_point = 1536,
  last_had_star = 48273409,
  vertical_scroll_bar = 54873988,
  left_margin_cols = 48273409,
  right_margin_cols = 48273409,
  left_fringe_width = 48273409,
  right_fringe_width = 48273409,
  fringes_outside_margins = 48273409,
  scroll_bar_width = 48273409,
  vertical_scroll_bar_type = 48273457,
  last_mark_x = 48273409,
  last_mark_y = 48273409,
  window_end_pos = 0,
  window_end_vpos = 0,
  window_end_valid = 48273409,
  update_mode_line = 48273409,
  start_at_line_beg = 48273457,
  display_table = 48273409,
  dedicated = 48273409,
  base_line_number = 8,
  base_line_pos = 8,
  region_showing = 48273409,
  column_number_displayed = 48273409,
  redisplay_end_trigger = 48273409,
  resize_proportionally = 48273409,
  orig_total_lines = 272,
  orig_top_line = 24,
  window_parameters = 48273409,
  current_matrix = 0x0,
  desired_matrix = 0x0,
  nrows_scale_factor = 1,
  ncols_scale_factor = 1,
  last_cursor = {
    x = 0,
    y = 0,
    hpos = 0,
    vpos = 0
  },
  cursor = {
    x = 0,
    y = 0,
    hpos = 0,
    vpos = 0
  },
  phys_cursor = {
    x = 0,
    y = 0,
    hpos = 0,
    vpos = 0
  },
  phys_cursor_type = -1,
  phys_cursor_width = -1,
  phys_cursor_ascent = 12,
  phys_cursor_height = 16,
  phys_cursor_on_p = 1,
  cursor_off_p = 0,
  last_cursor_off_p = 0,
  must_be_updated_p = 0,
  pseudo_window_p = 0,
  frozen_window_start_p = 0,
  vscroll = 0,
  window_end_bytepos = 0
}
(gdb) n
4686          adjust_glyphs (f);
(gdb) p *f
$4 = {
  size = 1073742869,
  next = 0x3245200,
  name = 49997459,
  icon_name = 48273409,
  title = 48273409,
  focus_frame = 48273409,
  root_window = 51028484,
  selected_window = 50011140,
  minibuffer_window = 50011140,
  param_alist = 52445997,
  scroll_bars = 54873092,
  condemned_scroll_bars = 48273409,
  menu_bar_items = 50027780,
  face_alist = 48839941,
  menu_bar_vector = 54169604,
  buffer_predicate = 48273409,
  buffer_list = 52389701,
  buried_buffer_list = 48273409,
  menu_bar_window = 48273409,
  tool_bar_window = 51028996,
  tool_bar_items = 55373828,
  desired_tool_bar_string = 49919939,
  current_tool_bar_string = 55037811,
  face_cache = 0x2fe9140,
  menu_bar_items_used = 0,
  namebuf = 0x2e32fa8 "emacs",
  current_pool = 0x0,
  desired_pool = 0x0,
  desired_matrix = 0x0,
  current_matrix = 0x0,
  glyphs_initialized_p = 1,
  resized_p = 0,
  force_flush_display_p = 0,
  default_face_done_p = 1,
  already_hscrolled_p = 0,
  updated_p = 1,
  minimize_tool_bar_window_p = 0,
  tool_bar_lines = 3,
  n_tool_bar_rows = 1,
  n_tool_bar_items = 14,
  decode_mode_spec_buffer = 0x30aa000 '-' <repeats 200 times>...,
  insert_line_cost = 0x0,
  delete_line_cost = 0x0,
  insert_n_lines_cost = 0x0,
  delete_n_lines_cost = 0x0,
  text_lines = 43,
  text_cols = 80,
  total_lines = 0,
  total_cols = 85,
  new_text_lines = 0,
  new_text_cols = 0,
  left_pos = 66,
  top_pos = 87,
  pixel_height = 688,
  pixel_width = 680,
  resx = 96,
  resy = 96,
  x_pixels_diff = 4,
  y_pixels_diff = 50,
  win_gravity = 1,
  size_hint_flags = 0,
  border_width = 2,
  internal_border_width = 0,
  column_width = 8,
  space_width = 8,
  line_height = 16,
  output_method = output_w32,
  terminal = 0x3263700,
  output_data = {
    tty = 0x2f97300,
    x = 0x2f97300,
    w32 = 0x2f97300,
    ns = 0x2f97300,
    nothing = 49902336
  },
  font_driver_list = 0x2fb7eb0,
  font_data_list = 0x0,
  fringe_cols = 2,
  left_fringe_width = 8,
  right_fringe_width = 8,
  want_fullscreen = FULLSCREEN_NONE,
  menu_bar_lines = 0,
  external_menu_bar = 1,
  display_preempted = 0 '\0',
  visible = 1 '\001',
  iconified = 0 '\0',
  async_visible = 1 '\001',
  async_iconified = 0 '\0',
  garbaged = 0 '\0',
  has_minibuffer = 1 '\001',
  wants_modeline = 1 '\001',
  can_have_scroll_bars = 1 '\001',
  auto_raise = 0 '\0',
  auto_lower = 0 '\0',
  no_split = 0 '\0',
  explicit_name = 0 '\0',
  window_sizes_changed = 0 '\0',
  mouse_moved = 0 '\0',
  pointer_invisible = 0 '\0',
  vertical_scroll_bar_type = vertical_scroll_bar_right,
  desired_cursor = FILLED_BOX_CURSOR,
  cursor_width = 48257509,
  blink_off_cursor = DEFAULT_CURSOR,
  blink_off_cursor_width = 0,
  message_buf = 0x313b000 "\200\002>\003P\034e\001",
  scroll_bottom_vpos = -1,
  config_scroll_bar_width = 17,
  config_scroll_bar_cols = 3,
  scroll_bar_actual_width = 24,
  cost_calculation_baud_rate = 19200,
  alpha = {-1, -1},
  gamma = 0,
  extra_line_spacing = 0,
  background_pixel = 50331647,
  foreground_pixel = 33554432
}
(gdb) n
4687          FRAME_WINDOW_SIZES_CHANGED (f) = 1;
(gdb) cont





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-24 12:58             ` Juanma Barranquero
@ 2009-09-24 15:32               ` martin rudalics
  2009-09-24 15:53                 ` Juanma Barranquero
  2009-09-25  8:35               ` Eli Zaretskii
  1 sibling, 1 reply; 27+ messages in thread
From: martin rudalics @ 2009-09-24 15:32 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 4534

[-- Attachment #1: Type: text/plain, Size: 448 bytes --]

 >>              shrink_mini_window (w);
 >>              ... should resize the mini_window down to one line ...
 >
 > That's exactly what happens, except that shrink_mini_window (w) does
 > *not* resize the miniwindow; it's still 6 lines height. So

Too bad.  Anyway, this configuration is completely useless to get the
original sizes back when we're done with the miniwindow.  Could you try
brute force as in the untested patch attached?

martin

[-- Attachment #2: xdisp.c.diff --]
[-- Type: text/plain, Size: 1295 bytes --]

*** xdisp.c.~1.1295.~	2009-08-20 10:47:19.687500000 +0200
--- xdisp.c	2009-09-24 17:23:23.937500000 +0200
***************
*** 8789,8816 ****
  	}
        else
  	{
! 	  /* Always resize to exact size needed.  */
! 	  if (height > WINDOW_TOTAL_LINES (w))
! 	    {
! 	      int old_height = WINDOW_TOTAL_LINES (w);
! 	      freeze_window_starts (f, 1);
! 	      grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
! 	      window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
! 	    }
! 	  else if (height < WINDOW_TOTAL_LINES (w))
! 	    {
! 	      int old_height = WINDOW_TOTAL_LINES (w);
! 	      freeze_window_starts (f, 0);
! 	      shrink_mini_window (w);
! 
! 	      if (height)
! 		{
! 		  freeze_window_starts (f, 1);
! 		  grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
! 		}
! 
! 	      window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
! 	    }
  	}
  
        if (old_current_buffer)
--- 8789,8799 ----
  	}
        else
  	{
! 	  int old_height = WINDOW_TOTAL_LINES (w);
! 	  freeze_window_starts (f, 1);
! 	  shrink_mini_window (w);
! 	  grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
! 	  window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
  	}
  
        if (old_current_buffer)

^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-24 15:32               ` martin rudalics
@ 2009-09-24 15:53                 ` Juanma Barranquero
  2009-09-24 16:10                   ` martin rudalics
  2009-09-24 17:36                   ` Stefan Monnier
  0 siblings, 2 replies; 27+ messages in thread
From: Juanma Barranquero @ 2009-09-24 15:53 UTC (permalink / raw)
  To: martin rudalics; +Cc: 4534

On Thu, Sep 24, 2009 at 17:32, martin rudalics <rudalics@gmx.at> wrote:

> Too bad.  Anyway, this configuration is completely useless to get the
> original sizes back when we're done with the miniwindow.  Could you try
> brute force as in the untested patch attached?

With that patch, and

   emacs -Q --eval "(setq resize-mini-windows t)"

the assertion triggers (delta == -1) as soon as I hit C-x

    Juanma





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-24 15:53                 ` Juanma Barranquero
@ 2009-09-24 16:10                   ` martin rudalics
  2009-09-24 16:22                     ` Juanma Barranquero
  2009-09-24 17:36                   ` Stefan Monnier
  1 sibling, 1 reply; 27+ messages in thread
From: martin rudalics @ 2009-09-24 16:10 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 4534

[-- Attachment #1: Type: text/plain, Size: 215 bytes --]

 > With that patch, and
 >
 >    emacs -Q --eval "(setq resize-mini-windows t)"
 >
 > the assertion triggers (delta == -1) as soon as I hit C-x

Because I removed the corresponding check.  Please try again.

martin

[-- Attachment #2: xdisp.c.diff --]
[-- Type: text/plain, Size: 1340 bytes --]

*** xdisp.c.~1.1295.~	2009-08-20 10:47:19.687500000 +0200
--- xdisp.c	2009-09-24 18:04:18.343750000 +0200
***************
*** 8789,8816 ****
  	}
        else
  	{
! 	  /* Always resize to exact size needed.  */
  	  if (height > WINDOW_TOTAL_LINES (w))
! 	    {
! 	      int old_height = WINDOW_TOTAL_LINES (w);
! 	      freeze_window_starts (f, 1);
! 	      grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
! 	      window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
! 	    }
! 	  else if (height < WINDOW_TOTAL_LINES (w))
! 	    {
! 	      int old_height = WINDOW_TOTAL_LINES (w);
! 	      freeze_window_starts (f, 0);
! 	      shrink_mini_window (w);
! 
! 	      if (height)
! 		{
! 		  freeze_window_starts (f, 1);
! 		  grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
! 		}
! 
! 	      window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
! 	    }
  	}
  
        if (old_current_buffer)
--- 8789,8800 ----
  	}
        else
  	{
! 	  int old_height = WINDOW_TOTAL_LINES (w);
! 	  freeze_window_starts (f, 1);
! 	  shrink_mini_window (w);
  	  if (height > WINDOW_TOTAL_LINES (w))
! 	    grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
! 	  window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
  	}
  
        if (old_current_buffer)

^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-24 16:10                   ` martin rudalics
@ 2009-09-24 16:22                     ` Juanma Barranquero
  2009-09-24 17:35                       ` martin rudalics
  0 siblings, 1 reply; 27+ messages in thread
From: Juanma Barranquero @ 2009-09-24 16:22 UTC (permalink / raw)
  To: martin rudalics; +Cc: 4534

On Thu, Sep 24, 2009 at 18:10, martin rudalics <rudalics@gmx.at> wrote:

> Because I removed the corresponding check.  Please try again.

Yeah, it works now. Cool.

    Juanma





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-24 16:22                     ` Juanma Barranquero
@ 2009-09-24 17:35                       ` martin rudalics
  2009-09-24 17:45                         ` Juanma Barranquero
  2009-09-24 22:03                         ` Stefan Monnier
  0 siblings, 2 replies; 27+ messages in thread
From: martin rudalics @ 2009-09-24 17:35 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 4534

 > Yeah, it works now. Cool.

Not really.  Exactly 10 years now that Gerd checked in grow_mini_window
and shrink_mini_window and apparently this bug has never been triggered
in all that time.

We could make `resize-mini-windows' a defcustom to find more such bugs.
Or make it t by default ;-)

martin





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-24 15:53                 ` Juanma Barranquero
  2009-09-24 16:10                   ` martin rudalics
@ 2009-09-24 17:36                   ` Stefan Monnier
  1 sibling, 0 replies; 27+ messages in thread
From: Stefan Monnier @ 2009-09-24 17:36 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 4534

>> Too bad.  Anyway, this configuration is completely useless to get the
>> original sizes back when we're done with the miniwindow.  Could you try
>> brute force as in the untested patch attached?

> With that patch, and

>    emacs -Q --eval "(setq resize-mini-windows t)"

> the assertion triggers (delta == -1) as soon as I hit C-x

Now that's more like it: a simple and consistent interface.


        Stefan "just feeling silly, please ignore"





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-24 17:35                       ` martin rudalics
@ 2009-09-24 17:45                         ` Juanma Barranquero
  2009-09-24 22:03                         ` Stefan Monnier
  1 sibling, 0 replies; 27+ messages in thread
From: Juanma Barranquero @ 2009-09-24 17:45 UTC (permalink / raw)
  To: martin rudalics; +Cc: 4534

On Thu, Sep 24, 2009 at 19:35, martin rudalics <rudalics@gmx.at> wrote:

> Not really.  Exactly 10 years now that Gerd checked in grow_mini_window
> and shrink_mini_window and apparently this bug has never been triggered
> in all that time.

I suppose my setup is somewhat non-typical. It's not the first time I
stumble upon a bug that's been there for years, latent, waiting for an
unsuspecting victim.

At least it's been fast, not like the "missing LF in ChangeLogs" bug
(#870) that I triggered dozens of times, Jason about two or three, and
apparently no one else. It took me eight months to be able to
reproduce it at will...

> We could make `resize-mini-windows' a defcustom to find more such bugs.
> Or make it t by default ;-)

Yes, it's been a while since the last defaults-changing flamewar. :)

    Juanma





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-24 17:35                       ` martin rudalics
  2009-09-24 17:45                         ` Juanma Barranquero
@ 2009-09-24 22:03                         ` Stefan Monnier
  2009-09-25 18:02                           ` Juanma Barranquero
  1 sibling, 1 reply; 27+ messages in thread
From: Stefan Monnier @ 2009-09-24 22:03 UTC (permalink / raw)
  To: martin rudalics; +Cc: Juanma Barranquero, 4534

> Not really.  Exactly 10 years now that Gerd checked in grow_mini_window
> and shrink_mini_window and apparently this bug has never been triggered
> in all that time.

IIUC, the bug triggered an assertion failure.  Most Emacs users run
without assertion checking, so that could explain the lack of
ealier reports (many assertion failures don't actually cause
a subsequent crash, they may not even cause a noticeable misbehavior in
some cases).


        Stefan





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-24 12:58             ` Juanma Barranquero
  2009-09-24 15:32               ` martin rudalics
@ 2009-09-25  8:35               ` Eli Zaretskii
  2009-09-25 11:30                 ` Juanma Barranquero
  1 sibling, 1 reply; 27+ messages in thread
From: Eli Zaretskii @ 2009-09-25  8:35 UTC (permalink / raw)
  To: Juanma Barranquero, 4534

> From: Juanma Barranquero <lekktu@gmail.com>
> Date: Thu, 24 Sep 2009 14:58:07 +0200
> Cc: 4534@emacsbugs.donarmstrong.com
> 
> > Now if I replace the check
> >
> >              if (height)
> >
> > by
> >
> >              if (height > WINDOW_TOTAL_LINES (w))
> >
> > I should be able to avoid the delta = -1 assertion failure in
> > grow_mini_window.  Can you confirm my reasoning so far?
> 
> It's correct. Except that, as shrink_mini_window didn't shrink the
> window, it remains at 6 lines.

Does this code cause an immediate redisplay?  I think it doesn't,
which means shrink_mini_window does not actually shrink the window, it
just prepares the glyph matrices for that.  The next redisplay will
actually change how things are shown on the screen.





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-25  8:35               ` Eli Zaretskii
@ 2009-09-25 11:30                 ` Juanma Barranquero
  2009-09-25 13:14                   ` Eli Zaretskii
  0 siblings, 1 reply; 27+ messages in thread
From: Juanma Barranquero @ 2009-09-25 11:30 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 4534

On Fri, Sep 25, 2009 at 10:35, Eli Zaretskii <eliz@gnu.org> wrote:

> Does this code cause an immediate redisplay?  I think it doesn't,
> which means shrink_mini_window does not actually shrink the window, it
> just prepares the glyph matrices for that.  The next redisplay will
> actually change how things are shown on the screen.

Hmm. The "else" part of shrink_mini_window (which works, in this case,
if you force it to go that route) definitely shrinks the window:

      Lisp_Object window;
      XSETWINDOW (window, w);
      enlarge_window (window, 1 - XFASTINT (w->total_lines), 0);

As for the "if" part, I think you're right.

Anyway, the last patch by Martin worked as expected, at least for this
bug. Is there any downside to it?

    Juanma





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-25 11:30                 ` Juanma Barranquero
@ 2009-09-25 13:14                   ` Eli Zaretskii
  2009-09-25 14:08                     ` Juanma Barranquero
  0 siblings, 1 reply; 27+ messages in thread
From: Eli Zaretskii @ 2009-09-25 13:14 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 4534

> From: Juanma Barranquero <lekktu@gmail.com>
> Date: Fri, 25 Sep 2009 13:30:38 +0200
> Cc: 4534@emacsbugs.donarmstrong.com, rudalics@gmx.at
> 
> Anyway, the last patch by Martin worked as expected, at least for this
> bug. Is there any downside to it?

I don't think so, I just wanted to maybe help explain the confusing
behavior.





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-25 13:14                   ` Eli Zaretskii
@ 2009-09-25 14:08                     ` Juanma Barranquero
  0 siblings, 0 replies; 27+ messages in thread
From: Juanma Barranquero @ 2009-09-25 14:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 4534

On Fri, Sep 25, 2009 at 15:14, Eli Zaretskii <eliz@gnu.org> wrote:

> I don't think so, I just wanted to maybe help explain the confusing
> behavior.

And indeed you did.

Thanks,

    Juanma





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-24 22:03                         ` Stefan Monnier
@ 2009-09-25 18:02                           ` Juanma Barranquero
  2009-10-16  8:32                             ` Juanma Barranquero
  0 siblings, 1 reply; 27+ messages in thread
From: Juanma Barranquero @ 2009-09-25 18:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 4534

On Fri, Sep 25, 2009 at 00:03, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> IIUC, the bug triggered an assertion failure.

Yes.

  xassert (delta >= 0);

at window.c:4637

> Most Emacs users run
> without assertion checking, so that could explain the lack of
> ealier reports (many assertion failures don't actually cause
> a subsequent crash, they may not even cause a noticeable misbehavior in
> some cases).

IMO, assertion checking should be enabled by default when compiling
for debug. I use it continuously (on both debug and optimized builds)
and Emacs is not noticeably slower; at least, not on the setups I've
tried it.

    Juanma





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-09-25 18:02                           ` Juanma Barranquero
@ 2009-10-16  8:32                             ` Juanma Barranquero
  2009-10-24 15:37                               ` Juanma Barranquero
  0 siblings, 1 reply; 27+ messages in thread
From: Juanma Barranquero @ 2009-10-16  8:32 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 4534

Martin spend a fair time debugging this problem, but he's now
developing new window code (post 23.2) that will make this obsolete.

AFAICS, the assertion is useless, because removing it causes no ill
effect (i.e., the shrinking/growing minibuffer code seem to be able to
cope with delta < 0). Even if it weren't so, most people are not
running Emacs with xasserts enabled; so any trouble caused by the
assertion not being true is not serious, or would likely have been
reported already.

So I'd suggest just commenting out the xassert.

Thoughts?

    Juanma





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: assertion failure at window.c:grow_mini_window
  2009-10-16  8:32                             ` Juanma Barranquero
@ 2009-10-24 15:37                               ` Juanma Barranquero
  0 siblings, 0 replies; 27+ messages in thread
From: Juanma Barranquero @ 2009-10-24 15:37 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 4534

OK, unless someone opposes I'm going to commit the attached patch.

Currently, both grow_mini_window() and shrink_window_lowest_first() do
in fact accept negative deltas, and act accordingly; so, the names are
misleading with respect to the actual behavior, if not the intent, of
both functions. I'm not comfortable with this, but as Martin said he
was going to rewrite the window code after 23.2, it's a short term
situation anyway.

Other than skipping a useless call to window_min_size() when delta <
0, the patch does not change current behavior, so for people building
without -DXASSERTS it should not introduce any new bug. For those
people with -DXASSERTS, the patch in fact avoids an unnecessary
exception and allows Emacs to continue without incident. That means
there's no obvious downside to this change; even assuming there's a
problem with negative deltas in grow_mini_window(), etc., it is better
to let the negative delta go through with the hope that it will cause
a traceable bug. Most people does not have -DXASSERTS, though, and not
such bug has even been reported.

   Juanma



2009-10-24  Juanma Barranquero  <lekktu@gmail.com>

	* window.c (grow_mini_window): Comment out "delta >= 0" assertion.
	For delta < 0, skip check that only makes sense when the mini-window
	is going to be enlarged.  (Bug#4534)


Index: src/window.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/window.c,v
retrieving revision 1.642
diff -u -2 -r1.642 window.c
--- src/window.c	23 Oct 2009 17:52:57 -0000	1.642
+++ src/window.c	24 Oct 2009 15:33:16 -0000
@@ -4649,10 +4649,13 @@

   xassert (MINI_WINDOW_P (w));
-  xassert (delta >= 0);
+  /* Commenting out the following assertion goes against the stated interface
+     of this function, but it currently does not seem to do anything useful.
+     See discussion of this issue in the thread for bug#4534.
+     xassert (delta >= 0); */

   /* Compute how much we can enlarge the mini-window without deleting
      other windows.  */
   root = XWINDOW (FRAME_ROOT_WINDOW (f));
-  if (delta)
+  if (delta > 0)
     {
       int min_height = window_min_size (root, 0, 0, 0, 0);





^ permalink raw reply	[flat|nested] 27+ messages in thread

* bug#4534: marked as done (assertion failure at window.c:grow_mini_window)
  2009-09-23  3:02 ` bug#4534: assertion failure at window.c:grow_mini_window Juanma Barranquero
  2009-09-23  7:28   ` martin rudalics
@ 2009-10-26 10:10   ` Emacs bug Tracking System
  1 sibling, 0 replies; 27+ messages in thread
From: Emacs bug Tracking System @ 2009-10-26 10:10 UTC (permalink / raw)
  To: Juanma Barranquero

[-- Attachment #1: Type: text/plain, Size: 919 bytes --]

Your message dated Mon, 26 Oct 2009 11:05:54 +0100
with message-id <f7ccd24b0910260305i10204d17hbdbfe72251d740f1@mail.gmail.com>
and subject line Re: bug#4534: assertion failure at window.c:grow_mini_window
has caused the Emacs bug report #4534,
regarding assertion failure at window.c:grow_mini_window
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@emacsbugs.donarmstrong.com
immediately.)


-- 
4534: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=4534
Emacs Bug Tracking System
Contact owner@emacsbugs.donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 20865 bytes --]

[-- Attachment #2.1.1: Type: text/plain, Size: 4786 bytes --]

GNU Emacs 23.1.50.1 (i386-mingw-nt5.1.2600) of 2009-09-22 on LEKTU
Compiled with gcc (4.3.3-tdm-1-dw2 mingw32) 4.3.3-dw2

I put the attached files into directory C:\temp, including the file test.el:

  (setq resize-mini-windows t)
  (setq ido-enable-flex-matching t)
  (setq ido-max-prospects 14)
  (ido-mode 1)

Then,

   emacs -Q -l c:/temp/test.el
   C-x C-f c:/temp/testfile <TAB> 3 <TAB> 7

Emacs aborts. (Note: As the failure depends on the number of lines in
the minibuffer, tweaking `ido-max-prospects' and/or adding more files
to the directory may be necessary to reproduce the bug.)

The xassert (delta >= 0) at the start of window.c:grow_mini_window
fails, because delta == -1. In resize_mini_window, the call to
xdisp.c:grow_mini_window has height == 5 and WINDOW_TOTAL_LINES (w) ==
6.

    Juanma



Breakpoint 1, w32_abort () at w32fns.c:7344
7344      button = MessageBox (NULL,
(gdb) bt
#0  w32_abort () at w32fns.c:7344
#1  0x011b929c in grow_mini_window (w=0x2f9ec00, delta=-1) at window.c:4637
#2  0x0106d122 in resize_mini_window (w=0x2f9ec00, exact_p=0) at xdisp.c:8809
#3  0x01075952 in redisplay_internal (preserve_echo_area=0) at xdisp.c:11536
#4  0x01073682 in redisplay () at xdisp.c:11031
#5  0x0100c78b in read_char (commandflag=1, nmaps=3, maps=0x82e1e0,
prev_event=48273409, used_mouse_menu=0x82e3c4, end_time=0x0)
    at keyboard.c:2707
#6  0x0101eb23 in read_key_sequence (keybuf=0x82e60c, bufsize=30,
prompt=48273409, dont_downcase_last=0, can_return_switch_frame=1,
    fix_current_buffer=1) at keyboard.c:9464
#7  0x01007a9a in command_loop_1 () at keyboard.c:1640
#8  0x01039cb2 in internal_condition_case (bfun=0x1007276
<command_loop_1>, handlers=48337089, hfun=0x10069ec <cmd_error>) at
eval.c:1513
#9  0x01006e85 in command_loop_2 () at keyboard.c:1357
#10 0x0103970b in internal_catch (tag=48447137, func=0x1006e65
<command_loop_2>, arg=48273409) at eval.c:1249
#11 0x01006dee in command_loop () at keyboard.c:1322
#12 0x01006143 in recursive_edit_1 () at keyboard.c:951
#13 0x0118feae in read_minibuf (map=52443485, initial=48273409,
prompt=49230995, backup_n=0, expflag=0, histvar=54300225, histpos=0,
    defalt=48273409, allow_props=0, inherit_input_method=0) at minibuf.c:739
#14 0x01193225 in Fcompleting_read (prompt=49230995,
collection=48635549, predicate=48273409, require_match=48273409,
    initial_input=48273409, hist=54300225, def=48273409,
inherit_input_method=48273409) at minibuf.c:1823
#15 0x0103df96 in Ffuncall (nargs=7, args=0x82eab0) at eval.c:3076
#16 0x011df195 in Fbyte_code (bytestr=51766515, vector=49979972,
maxdepth=56) at bytecode.c:678
#17 0x0103beb5 in Feval (form=48635773) at eval.c:2382
#18 0x0103970b in internal_catch (tag=49728209, func=0x103b477
<Feval>, arg=48635773) at eval.c:1249
#19 0x011dfdba in Fbyte_code (bytestr=54186131, vector=52804612,
maxdepth=176) at bytecode.c:853
#20 0x0103e7a9 in funcall_lambda (fun=50993028, nargs=6,
arg_vector=0x82f1d4) at eval.c:3232
#21 0x0103e005 in Ffuncall (nargs=7, args=0x82f1d0) at eval.c:3091
#22 0x011df195 in Fbyte_code (bytestr=51674739, vector=50023940,
maxdepth=64) at bytecode.c:678
#23 0x0103e7a9 in funcall_lambda (fun=50992164, nargs=1,
arg_vector=0x82f4f4) at eval.c:3232
#24 0x0103e005 in Ffuncall (nargs=2, args=0x82f4f0) at eval.c:3091
#25 0x011df195 in Fbyte_code (bytestr=49722835, vector=54198164,
maxdepth=16) at bytecode.c:678
#26 0x0103e7a9 in funcall_lambda (fun=50348772, nargs=0,
arg_vector=0x82f834) at eval.c:3232
#27 0x0103e005 in Ffuncall (nargs=1, args=0x82f830) at eval.c:3091
#28 0x0103d017 in apply1 (fn=49253217, arg=48273409) at eval.c:2786
#29 0x011e2be5 in Fcall_interactively (function=49253217,
record_flag=48273409, keys=48306948) at callint.c:395
#30 0x0103dbdc in Ffuncall (nargs=4, args=0x82faf8) at eval.c:3051
#31 0x0103d119 in call3 (fn=48471425, arg1=49253217, arg2=48273409,
arg3=48273409) at eval.c:2871
#32 0x01023a41 in Fcommand_execute (cmd=49253217,
record_flag=48273409, keys=48273409, special=48273409) at
keyboard.c:10453
#33 0x0100a993 in command_loop_1 () at keyboard.c:1901
#34 0x01039cb2 in internal_condition_case (bfun=0x1007276
<command_loop_1>, handlers=48337089, hfun=0x10069ec <cmd_error>) at
eval.c:1513
#35 0x01006e85 in command_loop_2 () at keyboard.c:1357
#36 0x0103970b in internal_catch (tag=48333209, func=0x1006e65
<command_loop_2>, arg=48273409) at eval.c:1249
#37 0x01006e3c in command_loop () at keyboard.c:1336
#38 0x01006143 in recursive_edit_1 () at keyboard.c:951
#39 0x01006618 in Frecursive_edit () at keyboard.c:1013
#40 0x01002a8d in main (argc=4, argv=0xa92840) at emacs.c:1827

Lisp Backtrace:
"completing-read" (0x82eab4)
"byte-code" (0x82ed40)
"ido-read-internal" (0x82f1d4)
"ido-file-internal" (0x82f4f4)
"ido-find-file" (0x82f834)
"call-interactively" (0x82fafc)
(gdb)

[-- Attachment #2.1.2: bugdata.zip --]
[-- Type: application/zip, Size: 10130 bytes --]

[-- Attachment #3: Type: message/rfc822, Size: 2897 bytes --]

From: Juanma Barranquero <lekktu@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: martin rudalics <rudalics@gmx.at>, 4534-done@emacsbugs.donarmstrong.com
Subject: Re: bug#4534: assertion failure at window.c:grow_mini_window
Date: Mon, 26 Oct 2009 11:05:54 +0100
Message-ID: <f7ccd24b0910260305i10204d17hbdbfe72251d740f1@mail.gmail.com>

> OK, unless someone opposes I'm going to commit the attached patch.

Done.

    Juanma

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2009-10-26 10:10 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <f7ccd24b0910260305i10204d17hbdbfe72251d740f1@mail.gmail.com>
2009-09-23  3:02 ` bug#4534: assertion failure at window.c:grow_mini_window Juanma Barranquero
2009-09-23  7:28   ` martin rudalics
2009-09-23  9:50     ` Juanma Barranquero
2009-09-23 10:51       ` Juanma Barranquero
2009-09-23 12:21         ` martin rudalics
2009-09-23 13:42           ` Juanma Barranquero
2009-09-24  6:49             ` martin rudalics
2009-09-23 12:21       ` martin rudalics
2009-09-23 13:41         ` Juanma Barranquero
2009-09-24  6:49           ` martin rudalics
2009-09-24 12:58             ` Juanma Barranquero
2009-09-24 15:32               ` martin rudalics
2009-09-24 15:53                 ` Juanma Barranquero
2009-09-24 16:10                   ` martin rudalics
2009-09-24 16:22                     ` Juanma Barranquero
2009-09-24 17:35                       ` martin rudalics
2009-09-24 17:45                         ` Juanma Barranquero
2009-09-24 22:03                         ` Stefan Monnier
2009-09-25 18:02                           ` Juanma Barranquero
2009-10-16  8:32                             ` Juanma Barranquero
2009-10-24 15:37                               ` Juanma Barranquero
2009-09-24 17:36                   ` Stefan Monnier
2009-09-25  8:35               ` Eli Zaretskii
2009-09-25 11:30                 ` Juanma Barranquero
2009-09-25 13:14                   ` Eli Zaretskii
2009-09-25 14:08                     ` Juanma Barranquero
2009-10-26 10:10   ` bug#4534: marked as done (assertion failure at window.c:grow_mini_window) Emacs bug Tracking System

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).