unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* emacs -nw segfaults toggling menu bar mode
@ 2005-04-06 23:28 Thien-Thi Nguyen
  2005-04-08  6:31 ` Marcelo Toledo
  2005-04-10  1:55 ` Richard Stallman
  0 siblings, 2 replies; 5+ messages in thread
From: Thien-Thi Nguyen @ 2005-04-06 23:28 UTC (permalink / raw)


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)

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

end of thread, other threads:[~2005-04-10 22:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-06 23:28 emacs -nw segfaults toggling menu bar mode Thien-Thi Nguyen
2005-04-08  6:31 ` Marcelo Toledo
2005-04-10  1:55 ` Richard Stallman
2005-04-10 10:20   ` Thien-Thi Nguyen
2005-04-10 22:14   ` Lute Kamstra

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).