Subject: Re: bug#15575: 24.3.50; New tty menus crash Emacs

From: Jan Djärv <[email-masked]>
Date: Thu, 10 Oct 2013 19:35:30 +0200

Hello.

10 okt 2013 kl. 18:15 skrev Eli Zaretskii <[email-masked]>:

>> From: Jan Djärv <[email-masked]>
>> Date: Thu, 10 Oct 2013 10:06:51 +0200
>> 
>> 9 okt 2013 kl. 21:00 skrev Eli Zaretskii <[email-masked]>:
>>> 
>>> Can you try the patch below?
>> 
>> Makes no difference on OSX or Fedora 19, still crashes in the same place.
> 
> How do you mean "the same place"?  That place should no longer exist
> after applying the patch.
> 
> If you mean the line marked below:
> 
>  /* Count how many glyphs to copy and copy the glyphs.  */
>  for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area)
>    for (i = 0; i < from->used[area]; i++)
>      to->glyphs[area][i] = from->glyphs[area][i];  <<<<<<<<<<<<<<
> 

It is the same place in the code, but not the same line in the file.

> then please tell what is the value of 'area' and of 'i' at the point
> of the crash.
> 

On Fedora 19:

(gdb) p area
$1 = 1
(gdb) p i
$2 = 0
(gdb) 

> Btw, did you compile with --enable-checking, i.e. were the 3 eassert
> statements at the beginning of deep_copy_glyph_row compiled into the
> program?

No, I did not.  I usually don't because the checkings more often than not trip on something that really isn't a bug.  I've never caught a real error with it.

This one triggers:

#3  0x0000000000449d2b in deep_copy_glyph_row (from=<optimized out>, 
    to=0xce9e40) at /home/jhd/src/emacs/current/src/xdisp.c:20597
20597	  eassert (to->used[0] == from->used[0]);

(gdb) p to->used[0]
$1 = -15072

There is some memory corruption.  If I press F11 twice and then F10, the crash does not happen. The menu appears but there are major redrawing problems, for example, going down in the menu does not work, it just scrolls the buffer instead until the menu disappears over the top, the buffer is not redrawn correctly when the menu goes away, nor is the menu bar.  I did not test it much.
Could be another symptom of the memory corruption.

	Jan D.