changeset 83050:85e5a786f728

Don't delete a tty if it's the last device with frames. src/term.c (delete_tty): Signal an error if this is the last display with live frames. Reported by Dan Nicolaescu. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-90
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 20 Feb 2004 17:51:35 +0000
parents b8aef5cd0bf2
children bd36a0907b8d
files src/term.c
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/term.c	Fri Feb 20 17:48:48 2004 +0000
+++ b/src/term.c	Fri Feb 20 17:51:35 2004 +0000
@@ -79,7 +79,6 @@
 static void tty_hide_cursor P_ ((struct tty_display_info *));
 
 void delete_initial_display P_ ((struct display *));
-void delete_tty P_ ((struct display *));
 void create_tty_output P_ ((struct frame *));
 void delete_tty_output P_ ((struct frame *));
 
@@ -2868,19 +2867,31 @@
   struct tty_display_info *tty;
   Lisp_Object tail, frame;
   char *tty_name;
+  int last_display;
   
   if (deleting_tty)
     /* We get a recursive call when we delete the last frame on this
        display. */
     return;
 
-  deleting_tty = 1;
-
   if (display->type != output_termcap)
     abort ();
 
   tty = display->display_info.tty;
   
+  last_display = 1;
+  FOR_EACH_FRAME (tail, frame)
+    {
+      struct frame *f = XFRAME (frame);
+      if (FRAME_LIVE_P (f) && (!FRAME_TERMCAP_P (f) || FRAME_TTY (f) != tty))
+        {
+          last_display = 0;
+          break;
+        }
+    }
+  if (last_display)
+      error ("Attempt to delete the sole display with live frames");
+  
   if (tty == tty_list)
     tty_list = tty->next;
   else
@@ -2897,6 +2908,8 @@
       tty->next = 0;
     }
 
+  deleting_tty = 1;
+
   FOR_EACH_FRAME (tail, frame)
     {
       struct frame *f = XFRAME (frame);