Handling X errors
************************************************************************/
+/* Error message passed to x_connection_closed. */
+
+static char *error_msg;
+
+/* Function installed as fatal_error_signal_hook.in
+ x_connection_closed. Print the X error message, and exit normally,
+ instead of dumping core when XtCloseDisplay fails. */
+
+static void
+x_fatal_error_signal ()
+{
+ fprintf (stderr, "%s\n", error_msg);
+ exit (70);
+}
+
/* Handle the loss of connection to display DPY. ERROR_MESSAGE is
the text of an error message that lead to the connection loss. */
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);
+ error_msg = (char *) alloca (strlen (error_message) + 1);
+ strcpy (error_msg, error_message);
handling_signal = 0;
/* Prevent being called recursively because of an error condition
/* If DPYINFO is null, this means we didn't open the display
in the first place, so don't try to close it. */
if (dpyinfo)
- XtCloseDisplay (dpy);
+ {
+ extern void (*fatal_error_signal_hook) P_ ((void));
+ fatal_error_signal_hook = x_fatal_error_signal;
+ XtCloseDisplay (dpy);
+ fatal_error_signal_hook = NULL;
+ }
#endif
/* Indicate that this display is dead. */
if (x_display_list == 0)
{
- fprintf (stderr, "%s\n", msg);
+ fprintf (stderr, "%s\n", error_msg);
shut_down_emacs (0, 0, Qnil);
exit (70);
}
TOTALLY_UNBLOCK_INPUT;
clear_waiting_for_input ();
- error ("%s", msg);
+ error ("%s", error_msg);
}