changeset 34213:029e36bf4993

Close the display. (xim_close_dpy): Handle case that the display has been closed.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 05 Dec 2000 16:47:04 +0000
parents 183f7913ab90
children dd1531cdd9ef
files src/xterm.c
diffstat 1 files changed, 23 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Tue Dec 05 14:42:26 2000 +0000
+++ b/src/xterm.c	Tue Dec 05 16:47:04 2000 +0000
@@ -11263,14 +11263,26 @@
   struct x_display_info *dpyinfo = x_display_info_for_display (display);
   Lisp_Object frame, tail;
 
-  /* Indicate that this display is dead.  */
-
-#if 0 /* Closing the display caused a bus error on OpenWindows.  */
+  /* We have to close the display to inform Xt that it doesn't
+     exist anymore.  If we don't, Xt will continue to wait for
+     events from the display.  As a consequence, a sequence of
+
+     M-x make-frame-on-display RET :1 RET
+     ...kill the new frame, so that we get an IO error...
+     M-x make-frame-on-display RET :1 RET
+
+     will indefinitely wait in Xt for events for display `:1', opened
+     in the first class to make-frame-on-display.
+
+     Closing the display is reported to lead to a bus error on
+     OpenWindows in certain situations.  I suspect that is a bug
+     in OpenWindows.  I don't know how to cicumvent it here.  */
+  
 #ifdef USE_X_TOOLKIT
   XtCloseDisplay (display);
 #endif
-#endif
-
+
+  /* Indicate that this display is dead.  */
   if (dpyinfo)
     dpyinfo->display = 0;
 
@@ -11658,11 +11670,13 @@
 {
 #ifdef USE_XIM
 #ifdef HAVE_X11R6_XIM
-  XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
-				    NULL, EMACS_CLASS,
-				    xim_instantiate_callback, NULL);
+  if (dpyinfo->display)
+    XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
+				      NULL, EMACS_CLASS,
+				      xim_instantiate_callback, NULL);
 #endif /* not HAVE_X11R6_XIM */
-  XCloseIM (dpyinfo->xim);
+  if (dpyinfo->display)
+    XCloseIM (dpyinfo->xim);
   dpyinfo->xim = NULL;
   XFree (dpyinfo->xim_styles);
 #endif /* USE_XIM */