From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#15575: 24.3.50; New tty menus crash Emacs Date: Wed, 09 Oct 2013 22:00:34 +0300 Message-ID: <834n8qqnfx.fsf@gnu.org> References: <7A5C065F-4E90-4846-80EE-650AF314DCB2@swipnet.se> <83a9iiqr49.fsf@gnu.org> <5D661800-C7B5-495B-BF9D-F2E1F16C9B93@swipnet.se> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT X-Trace: ger.gmane.org 1381345280 8384 80.91.229.3 (9 Oct 2013 19:01:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 9 Oct 2013 19:01:20 +0000 (UTC) Cc: 15575@debbugs.gnu.org To: Jan =?UTF-8?Q?Dj=C3=A4rv?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 09 21:01:19 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VTz0V-0001dZ-Dl for geb-bug-gnu-emacs@m.gmane.org; Wed, 09 Oct 2013 21:01:15 +0200 Original-Received: from localhost ([::1]:43400 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTz0V-0007iM-4v for geb-bug-gnu-emacs@m.gmane.org; Wed, 09 Oct 2013 15:01:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57213) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTz0N-0007iE-UR for bug-gnu-emacs@gnu.org; Wed, 09 Oct 2013 15:01:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VTz0I-0002l8-Ok for bug-gnu-emacs@gnu.org; Wed, 09 Oct 2013 15:01:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:58341) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTz0I-0002kd-K1 for bug-gnu-emacs@gnu.org; Wed, 09 Oct 2013 15:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VTz0I-0006MR-AA for bug-gnu-emacs@gnu.org; Wed, 09 Oct 2013 15:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Oct 2013 19:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15575 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15575-submit@debbugs.gnu.org id=B15575.138134524523300 (code B ref 15575); Wed, 09 Oct 2013 19:01:02 +0000 Original-Received: (at 15575) by debbugs.gnu.org; 9 Oct 2013 19:00:45 +0000 Original-Received: from localhost ([127.0.0.1]:38399 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VTz00-00062h-3w for submit@debbugs.gnu.org; Wed, 09 Oct 2013 15:00:44 -0400 Original-Received: from mtaout23.012.net.il ([80.179.55.175]:46924) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VTyzw-0005wt-Ar for 15575@debbugs.gnu.org; Wed, 09 Oct 2013 15:00:41 -0400 Original-Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MUF009000O9D100@a-mtaout23.012.net.il> for 15575@debbugs.gnu.org; Wed, 09 Oct 2013 22:00:38 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MUF009QE0T1CZ00@a-mtaout23.012.net.il>; Wed, 09 Oct 2013 22:00:38 +0300 (IDT) In-reply-to: <5D661800-C7B5-495B-BF9D-F2E1F16C9B93@swipnet.se> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:79116 Archived-At: > From: Jan Djärv > Date: Wed, 9 Oct 2013 19:58:57 +0200 > Cc: 15575@debbugs.gnu.org > > (gdb) p from->used[0] > $1 = 30065 > (gdb) p from->used[1] > $2 = 26977 > (gbd) p from->used[2] > $3 = 12140 I don't see how this could be true, I guess the compiler fools the debugger here. > (gdb) p to->used[0] > $7 = 4 > (gdb) p to->used[1] > $8 = 0 > (gdb) p to->used[2] > $9 = 0 Likewise, this doesn't seem to be possible on a TTY. Sigh... > (gdb) p to->glyphs[0] > $10 = (struct glyph *) 0x4 > (gdb) p to->glyphs[1] > $11 = (struct glyph *) 0x4 > (gdb) p to->glyphs[2] > $12 = (struct glyph *) 0x4 Neither can this be true, I think. Or maybe I'm missing something. > (gdb) p sizeof(struct glyph) > $13 = 48 This one is the only one that makes sense, but it's not a variable, so I'm not surprised. > These values vary if run again. Here is another run: > > $1 = 12346 > $2 = 384 > $3 = 1 > $4 = (struct glyph *) 0x3000000000000088 > $5 = (struct glyph *) 0x100f11e21 > $6 = (struct glyph *) 0x10180300a > $7 = 12346 > $8 = 384 > $9 = 1 > $10 = (struct glyph *) 0x104033e00 > $11 = (struct glyph *) 0x1040c48e0 > $12 = (struct glyph *) 0x1040c90e0 > $13 = 48 > $14 = 12731 > $15 = 0 Can you try the patch below? === modified file 'src/xdisp.c' --- src/xdisp.c 2013-10-08 17:49:20 +0000 +++ src/xdisp.c 2013-10-09 18:44:38 +0000 @@ -20589,11 +20589,14 @@ display_menu_bar (struct window *w) static void deep_copy_glyph_row (struct glyph_row *to, struct glyph_row *from) { - int area, i, sum_used = 0; + int area, i; struct glyph *pointers[1 + LAST_AREA]; /* Save glyph pointers of TO. */ memcpy (pointers, to->glyphs, sizeof to->glyphs); + eassert (to->used[0] == from->used[0]); + eassert (to->used[1] == from->used[1]); + eassert (to->used[2] == from->used[2]); /* Do a structure assignment. */ *to = *from; @@ -20601,22 +20604,10 @@ deep_copy_glyph_row (struct glyph_row *t /* Restore original pointers of TO. */ memcpy (to->glyphs, pointers, sizeof to->glyphs); - /* Count how many glyphs to copy and update glyph pointers. */ + /* Count how many glyphs to copy and copy the glyphs. */ for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area) - { - if (area > LEFT_MARGIN_AREA) - { - eassert (from->glyphs[area] - from->glyphs[area - 1] - == from->used[area - 1]); - to->glyphs[area] = to->glyphs[area - 1] + to->used[area - 1]; - } - sum_used += from->used[area]; - } - - /* Copy the glyphs. */ - eassert (sum_used <= to->glyphs[LAST_AREA] - to->glyphs[LEFT_MARGIN_AREA]); - for (i = 0; i < sum_used; i++) - to->glyphs[LEFT_MARGIN_AREA][i] = from->glyphs[LEFT_MARGIN_AREA][i]; + for (i = 0; i < from->used[area]; i++) + to->glyphs[area][i] = from->glyphs[area][i]; } /* Display one menu item on a TTY, by overwriting the glyphs in the