comparison src/device-x.c @ 756:00793f182d30

[xemacs-hg @ 2002-02-22 17:12:26 by michaels] 2002-02-11 Mike Sperber <mike@xemacs.org> * device-x.c: (x_IO_error_handler): (x_init_device): Temporarily keep device in static variable `device_being_initialized' so we can recover gracefully from internal XOpenDevice failure. (XOpenDevice is documented to return NULL on failure, but sometimes calls the IO error handler instead.)
author michaels
date Fri, 22 Feb 2002 17:12:27 +0000
parents fdefd0186b75
children 943eaba38521
comparison
equal deleted inserted replaced
755:da44ff90109f 756:00793f182d30
165 165
166 166
167 /************************************************************************/ 167 /************************************************************************/
168 /* initializing an X connection */ 168 /* initializing an X connection */
169 /************************************************************************/ 169 /************************************************************************/
170
171 static struct device *device_being_initialized = NULL;
170 172
171 static void 173 static void
172 allocate_x_device_struct (struct device *d) 174 allocate_x_device_struct (struct device *d)
173 { 175 {
174 d->device_data = xnew_and_zero (struct x_device); 176 d->device_data = xnew_and_zero (struct x_device);
561 * we initialize Xt. This is so we can automagically support 563 * we initialize Xt. This is so we can automagically support
562 * both `Emacs' and `XEmacs' application classes. 564 * both `Emacs' and `XEmacs' application classes.
563 */ 565 */
564 slow_down_interrupts (); 566 slow_down_interrupts ();
565 /* May not be needed but XtOpenDisplay could not deal with signals here. */ 567 /* May not be needed but XtOpenDisplay could not deal with signals here. */
568 device_being_initialized = d;
566 dpy = DEVICE_X_DISPLAY (d) = XOpenDisplay (disp_name); 569 dpy = DEVICE_X_DISPLAY (d) = XOpenDisplay (disp_name);
570 device_being_initialized = NULL;
567 speed_up_interrupts (); 571 speed_up_interrupts ();
568 572
569 if (dpy == 0) 573 if (dpy == 0)
570 { 574 {
571 suppress_early_error_handler_backtrace = 1; 575 suppress_early_error_handler_backtrace = 1;
1115 { 1119 {
1116 /* This function can GC */ 1120 /* This function can GC */
1117 Lisp_Object dev; 1121 Lisp_Object dev;
1118 struct device *d = get_device_from_display_1 (disp); 1122 struct device *d = get_device_from_display_1 (disp);
1119 1123
1124 if (!d)
1125 d = device_being_initialized;
1126
1120 assert (d != NULL); 1127 assert (d != NULL);
1121 XSETDEVICE (dev, d); 1128 XSETDEVICE (dev, d);
1122 1129
1123 if (NILP (find_nonminibuffer_frame_not_on_device (dev))) 1130 if (NILP (find_nonminibuffer_frame_not_on_device (dev)))
1124 { 1131 {