emacs-devel
[Top][All Lists]
Advanced

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

segfault when resizing terminal window


From: Dan Nicolaescu
Subject: segfault when resizing terminal window
Date: Fri, 30 Jan 2009 00:49:31 -0800 (PST)

emacs -Q -f server-start &

emacsclient -t
C-z
emacsclient -t

now resize the terminal window.... segfault...

The dispnew.c part of the patch below takes care of the segfault.

The other part of the patch takes care of resizing when resuming the
suspended terminal frame. 

Given that the pretest is so close, I'd rather not just check in this
before without asking for a second opinion.

BTW does anyone know what is the reason to have have MSDOS and subprocesses
#ifdefs in `resume-tty'? `resume-tty' can't really be executed on MSDOS... 

Index: dispnew.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/dispnew.c,v
retrieving revision 1.426
diff -u -3 -p -r1.426 dispnew.c
--- dispnew.c   25 Jan 2009 17:00:55 -0000      1.426
+++ dispnew.c   30 Jan 2009 08:37:31 -0000
@@ -6218,6 +6218,10 @@ window_change_signal (signalnum) /* If w
     if (! tty->term_initted)
       continue;
 
+    /* Suspended tty frames have tty->input == NULL, avoid accessing it.  */
+    if (!tty->input)
+      continue;
+    
     get_tty_size (fileno (tty->input), &width, &height);
 
     if (width > 5 && height > 2) {

Index: term.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/term.c,v
retrieving revision 1.234
diff -u -3 -p -r1.234 term.c
--- term.c      8 Jan 2009 03:15:58 -0000       1.234
+++ term.c      30 Jan 2009 08:37:31 -0000
@@ -2470,7 +2470,17 @@ the currently selected frame. */)
 #endif
 
       if (FRAMEP (t->display_info.tty->top_frame))
-        FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1);
+       {
+         struct frame *f = XFRAME (t->display_info.tty->top_frame);
+         int width, height;
+         int old_height = FRAME_COLS (f);
+         int old_width = FRAME_LINES (f);
+         /* Check if terminal/window size has changed.  */
+         get_tty_size (fileno (t->display_info.tty->input), &width, &height);
+         if (width != old_width || height != old_height)
+           change_frame_size (f, height, width, 0, 0, 0);
+         FRAME_SET_VISIBLE (XFRAME (t->display_info.tty->top_frame), 1);
+       }
 
       init_sys_modes (t->display_info.tty);
 




reply via email to

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