changeset 83272:b877c1847af1

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
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 19 Mar 2005 20:38:03 +0000
parents 1830bcd0eec0
children 1cd1aa464b44
files src/xfns.c src/xterm.c
diffstat 2 files changed, 22 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- 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;
 }
--- 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;
 }