X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/60f5c938324b2831216deeb60969c53d409784f5..b12f6e85a068462962d1bf012260e2b55aabd4e7:/src/terminal.c diff --git a/src/terminal.c b/src/terminal.c index fa6a0a4f51..c7d3da5d93 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -1,11 +1,11 @@ /* Functions related to terminal devices. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GNU Emacs. GNU Emacs is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) +the Free Software Foundation; either version 3, or (at your option) any later version. GNU Emacs is distributed in the hope that it will be useful, @@ -270,16 +270,22 @@ mark_terminals (void) } -/* Remove a terminal from the terminal list and free its memory. */ +/* Low-level function to close all frames on a terminal, remove it + from the terminal list and free its memory. */ void delete_terminal (struct terminal *terminal) { struct terminal **tp; Lisp_Object tail, frame; - - /* Check for and close live frames that are still on this - terminal. */ + + /* Protect against recursive calls. Fdelete_frame calls the + delete_terminal_hook when we delete our last frame. */ + if (terminal->deleted) + return; + terminal->deleted = 1; + + /* Check for live frames that are still on this terminal. */ FOR_EACH_FRAME (tail, frame) { struct frame *f = XFRAME (frame); @@ -575,8 +581,9 @@ init_initial_terminal (void) initial_terminal = create_terminal (); initial_terminal->type = output_initial; initial_terminal->name = xstrdup ("initial_terminal"); +#ifdef MULTI_KBOARD initial_terminal->kboard = initial_kboard; - +#endif initial_terminal->delete_terminal_hook = &delete_initial_terminal; /* All other hooks are NULL. */