diff src/xterm.c @ 83522:a5d712e6585a

Fix crashes in `delete-terminal' caused by recursive calls or X displays with live frames. * src/termhooks.h (terminal) <deleted>: New member. * src/term.c (delete_tty): Use it. (deleting_tty): Remove old variable. * src/terminal.c (delete_terminal): Use terminal->deleted. * src/xterm.c (x_delete_terminal): Use terminal->deleted. Delete all frames on the display explicitly. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-562
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 20 May 2006 12:20:41 +0000
parents ab6ab63755f7
children b2e7507b55c6
line wrap: on
line diff
--- a/src/xterm.c	Sat May 20 12:00:16 2006 +0000
+++ b/src/xterm.c	Sat May 20 12:20:41 2006 +0000
@@ -10837,6 +10837,24 @@
 {
   struct x_display_info *dpyinfo = terminal->display_info.x;
   int i;
+  Lisp_Object tail, frame;
+
+  /* Protect against recursive calls.  Fdelete_frame calls us back
+     when we delete our last frame.  */
+  if (terminal->deleted)
+    return;
+  terminal->deleted = 1;
+
+  /* Check for and close live frames that are still on this
+     terminal. */
+  FOR_EACH_FRAME (tail, frame)
+    {
+      struct frame *f = XFRAME (frame);
+      if (FRAME_LIVE_P (f) && f->terminal == terminal)
+        {
+          Fdelete_frame (frame, Qt);
+        }
+    }
 
   BLOCK_INPUT;
   /* Free the fonts in the font table.  */