emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs -nw segfaults toggling menu bar mode


From: Thien-Thi Nguyen
Subject: emacs -nw segfaults toggling menu bar mode
Date: Thu, 07 Apr 2005 01:28:37 +0200

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)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]