signal (signalnum, x_connection_signal);
#endif /* USG */
}
+
\f
-/* Handling X errors. */
+/************************************************************************
+ Handling X errors
+ ************************************************************************/
-/* Handle the loss of connection to display DISPLAY. */
+/* Handle the loss of connection to display DPY. ERROR_MESSAGE is
+ the text of an error message that lead to the connection loss. */
static SIGTYPE
x_connection_closed (dpy, error_message)
{
struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
Lisp_Object frame, tail;
-
+ int count;
+ char *msg;
+
+ msg = (char *) alloca (strlen (error_message) + 1);
+ strcpy (msg, error_message);
handling_signal = 0;
+ /* Prevent being called recursively because of an error condition
+ below. Otherwise, we might end up with printing ``can't find per
+ display information'' in the recursive call instead of printing
+ the original message here. */
+ count = x_catch_errors (dpy);
+
/* 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
in OpenWindows. I don't know how to cicumvent it here. */
#ifdef USE_X_TOOLKIT
- {
- /* Prevent being called recursively because of an error condition
- in XtCloseDisplay. Otherwise, we might end up with printing
- ``can't find per display information'' in the recursive call
- instead of printing the original message here. */
- int count = x_catch_errors (dpy);
- XtCloseDisplay (dpy);
- x_uncatch_errors (dpy, count);
- }
+ XtCloseDisplay (dpy);
#endif
/* Indicate that this display is dead. */
if (dpyinfo)
x_delete_display (dpyinfo);
+ x_uncatch_errors (dpy, count);
+
if (x_display_list == 0)
{
- fprintf (stderr, "%s\n", error_message);
+ fprintf (stderr, "%s\n", msg);
shut_down_emacs (0, 0, Qnil);
exit (70);
}
TOTALLY_UNBLOCK_INPUT;
clear_waiting_for_input ();
- error ("%s", error_message);
+ error ("%s", msg);
}
+
/* This is the usual handler for X protocol errors.
It kills all frames on the display that we got the error for.
If that was the only one, it prints an error message and kills Emacs. */
x_connection_closed (display, buf1);
}
+
/* This is the first-level handler for X protocol errors.
It calls x_error_quitter or x_error_catcher. */