2004-08-24 Jan Dj\e,Ad\e(Brv <jan.h.d@swipnet.se>
+ * xterm.c (x_catch_errors_unwind): Do not XSync if display has closed.
+
* xfns.c (x_window_to_frame, x_any_window_to_frame)
(x_non_menubar_window_to_frame, x_menubar_window_to_frame)
(x_top_window_to_frame): Return 0 if wdesc is None.
x_catch_errors_unwind (old_val)
Lisp_Object old_val;
{
- Lisp_Object first;
+ Lisp_Object first = XCAR (old_val);
+ Display *dpy = XSAVE_VALUE (first)->pointer;
- first = XCAR (old_val);
-
- XSync (XSAVE_VALUE (first)->pointer, False);
+ /* The display may have been closed before this function is called.
+ Check if it is still open before calling XSync. */
+ if (x_display_info_for_display (dpy) != 0)
+ XSync (dpy, False);
x_error_message_string = XCDR (old_val);
return Qnil;