Close the X connection when the last frame is deleted.
authorKaroly Lorentey <lorentey@elte.hu>
Sat, 19 Mar 2005 20:38:03 +0000 (20:38 +0000)
committerKaroly Lorentey <lorentey@elte.hu>
Sat, 19 Mar 2005 20:38:03 +0000 (20:38 +0000)
* 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

src/xfns.c
src/xterm.c

index 72547e2..2487e67 100644 (file)
@@ -4051,25 +4051,7 @@ If DISPLAY is nil, that stands for the selected frame's display.  */)
   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;
 }
index 2fd9e6b..36f1630 100644 (file)
@@ -10767,8 +10767,27 @@ static struct redisplay_interface x_redisplay_interface =
 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;
 }