From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: segfault when resizing terminal window Date: Fri, 30 Jan 2009 00:49:31 -0800 (PST) Message-ID: <200901300849.n0U8nVqj022365@rodan.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1233305402 19764 80.91.229.12 (30 Jan 2009 08:50:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 Jan 2009 08:50:02 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jan 30 09:51:16 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LSp5o-0008JI-4j for ged-emacs-devel@m.gmane.org; Fri, 30 Jan 2009 09:51:16 +0100 Original-Received: from localhost ([127.0.0.1]:34641 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LSp4V-0005W5-Qr for ged-emacs-devel@m.gmane.org; Fri, 30 Jan 2009 03:49:55 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LSp4Q-0005Tr-1L for emacs-devel@gnu.org; Fri, 30 Jan 2009 03:49:50 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LSp4O-0005SW-Cl for emacs-devel@gnu.org; Fri, 30 Jan 2009 03:49:48 -0500 Original-Received: from [199.232.76.173] (port=50703 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LSp4O-0005SR-8W for emacs-devel@gnu.org; Fri, 30 Jan 2009 03:49:48 -0500 Original-Received: from barrelv2.ics.uci.edu ([128.195.1.114]:51326) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1LSp4N-0007dS-NO for emacs-devel@gnu.org; Fri, 30 Jan 2009 03:49:48 -0500 Original-Received: from rodan.ics.uci.edu (rodan.ics.uci.edu [128.195.6.9]) by barrelv2.ics.uci.edu (8.13.8+Sun/8.13.8) with ESMTP id n0U8nVQb003675 for ; Fri, 30 Jan 2009 00:49:32 -0800 (PST) Original-Received: (from dann@localhost) by rodan.ics.uci.edu (8.13.8+Sun/8.13.6/Submit) id n0U8nVqj022365; Fri, 30 Jan 2009 00:49:31 -0800 (PST) Original-Lines: 65 X-ICS-MailScanner-Information: Please contact the ISP for more information X-ICS-MailScanner-ID: n0U8nVQb003675 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.44, required 5, autolearn=disabled, ALL_TRUSTED -1.44) X-ICS-MailScanner-From: dann@rodan.ics.uci.edu X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) 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:108391 Archived-At: 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);