* 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
\f
-static int deleting_tty = 0;
-
-
/* Delete the given tty terminal, closing all frames on it. */
static void
char *tty_name;
int last_terminal;
- if (deleting_tty)
- /* We get a recursive call when we delete the last frame on this
- terminal. */
+ /* Protect against recursive calls. Fdelete_frame calls us back
+ when we delete our last frame. */
+ if (terminal->deleted)
return;
if (terminal->type != output_termcap)
tty->next = 0;
}
- deleting_tty = 1;
+ /* We must not throw any errors below this line. */
+ terminal->deleted = 1;
FOR_EACH_FRAME (tail, frame)
{
/* The number of frames that are on this terminal. */
int reference_count;
-
+
+ /* Nonzero while deleting this terminal. Used to protect against
+ recursive calls to delete_terminal_hook. */
+ int deleted;
+
/* The type of the terminal device. */
enum output_method type;
{
struct terminal **tp;
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 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. */