all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dan Nicolaescu <dann@ics.uci.edu>
To: emacs-devel@gnu.org
Subject: segfault when resizing terminal window
Date: Fri, 30 Jan 2009 00:49:31 -0800 (PST)	[thread overview]
Message-ID: <200901300849.n0U8nVqj022365@rodan.ics.uci.edu> (raw)


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	other threads:[~2009-01-30  8:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-30  8:49 Dan Nicolaescu [this message]
2009-01-30 18:21 ` segfault when resizing terminal window Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200901300849.n0U8nVqj022365@rodan.ics.uci.edu \
    --to=dann@ics.uci.edu \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.