From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.devel Subject: emacs -nw segfaults toggling menu bar mode Date: Thu, 07 Apr 2005 01:28:37 +0200 Message-ID: Reply-To: ttn@glug.org NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1112830627 8067 80.91.229.2 (6 Apr 2005 23:37:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 6 Apr 2005 23:37:07 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 07 01:37:05 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DJK4T-0003Cs-Pd for ged-emacs-devel@m.gmane.org; Thu, 07 Apr 2005 01:36:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DJJdf-0002Vy-JA for ged-emacs-devel@m.gmane.org; Wed, 06 Apr 2005 19:08:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DJJVW-0004HW-NC for emacs-devel@gnu.org; Wed, 06 Apr 2005 19:00:27 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DJJVW-0004CC-Bz for emacs-devel@gnu.org; Wed, 06 Apr 2005 19:00:22 -0400 Original-Received: from [151.41.163.219] (helo=surf.glug.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DJJrN-0008NA-Lu for emacs-devel@gnu.org; Wed, 06 Apr 2005 19:22:58 -0400 Original-Received: from ttn by surf.glug.org with local (Exim 3.35 #1 (Debian)) id 1DJJwr-0002gd-00 for ; Thu, 07 Apr 2005 01:28:37 +0200 Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:35663 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:35663 with a 2005-04-06 cvs update, and configured w/ no options, i built and then started emacs like so: emacs -nw -q --no-site-file then i did: M-x menu-bar-mode this turned off the menu bar as expected. then i did: M-x menu-bar-mode this segfaulted. poking around w/ gdb, i eventually came up w/ the following patch, which prevents the segfault. could someone review it (i'm not very familiar w/ this area of emacs) and let me know how to improve it? thi ________________________________________________________________ diff -c -r1.343 dispnew.c *** dispnew.c 17 Mar 2005 23:39:12 -0000 1.343 --- dispnew.c 6 Apr 2005 23:14:17 -0000 *************** *** 3165,3178 **** int m2_from; w2 = frame_row_to_window (root, frame_from); ! m2 = w2->current_matrix; ! m2_from = frame_from - m2->matrix_y; ! copy_row_except_pointers (m->rows + window_to, ! m2->rows + m2_from); ! ! /* If frame line is empty, window line is empty, too. */ ! if (!retained_p[copy_from[i]]) ! m->rows[window_to].enabled_p = 0; sync_p = 1; } else if (from_inside_window_p) --- 3165,3184 ---- int m2_from; w2 = frame_row_to_window (root, frame_from); ! /* Apparently, when turning on the menu bar using "emacs ! -nw", `from_frame' does not yield an associated window. ! This check avoids a segfault. */ ! if (w2) ! { ! m2 = w2->current_matrix; ! m2_from = frame_from - m2->matrix_y; ! copy_row_except_pointers (m->rows + window_to, ! m2->rows + m2_from); ! ! /* If frame line is empty, window line is empty, too. */ ! if (!retained_p[copy_from[i]]) ! m->rows[window_to].enabled_p = 0; ! } sync_p = 1; } else if (from_inside_window_p)