# HG changeset patch # User Karoly Lorentey # Date 1111264683 0 # Node ID b877c1847af1e65e9264df0fd5e034367be8db6d # Parent 1830bcd0eec0ddf64419f161f2450b93b616235e Close the X connection when the last frame is deleted. * src/xfns.c (Fx_close_connection): Move code to x_delete_frame_display. (x_delete_frame_display): Actually close the X connection. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-312 diff -r 1830bcd0eec0 -r b877c1847af1 src/xfns.c --- a/src/xfns.c Sat Mar 19 17:55:13 2005 +0000 +++ b/src/xfns.c Sat Mar 19 20:38:03 2005 +0000 @@ -4051,25 +4051,7 @@ if (dpyinfo->reference_count > 0) error ("Display still has frames on it"); - BLOCK_INPUT; - /* Free the fonts in the font table. */ - for (i = 0; i < dpyinfo->n_fonts; i++) - if (dpyinfo->font_table[i].name) - { - XFreeFont (dpyinfo->display, dpyinfo->font_table[i].font); - } - - x_destroy_all_bitmaps (dpyinfo); - XSetCloseDownMode (dpyinfo->display, DestroyAll); - -#ifdef USE_X_TOOLKIT - XtCloseDisplay (dpyinfo->display); -#else - XCloseDisplay (dpyinfo->display); -#endif - - x_delete_display (dpyinfo); - UNBLOCK_INPUT; + x_delete_frame_display (dpyinfo->frame_display); return Qnil; } diff -r 1830bcd0eec0 -r b877c1847af1 src/xterm.c --- a/src/xterm.c Sat Mar 19 17:55:13 2005 +0000 +++ b/src/xterm.c Sat Mar 19 20:38:03 2005 +0000 @@ -10767,8 +10767,27 @@ void x_delete_frame_display (struct display *display) { - /* We don't do anything, the connection to the X server must remain - open. */ + struct x_display_info *dpyinfo = display->display_info; + + BLOCK_INPUT; + /* Free the fonts in the font table. */ + for (i = 0; i < dpyinfo->n_fonts; i++) + if (dpyinfo->font_table[i].name) + { + XFreeFont (dpyinfo->display, dpyinfo->font_table[i].font); + } + + x_destroy_all_bitmaps (dpyinfo); + XSetCloseDownMode (dpyinfo->display, DestroyAll); + +#ifdef USE_X_TOOLKIT + XtCloseDisplay (dpyinfo->display); +#else + XCloseDisplay (dpyinfo->display); +#endif + + x_delete_display (dpyinfo); + UNBLOCK_INPUT; }