diff src/frame.c @ 546:666d73d6ac56

[xemacs-hg @ 2001-05-20 01:17:07 by ben] fixes so MinGW compiles. console-msw.h, scrollbar-msw.c, event-msw.c: we might receive scrollbar events on windows without scrollbars (e.g. holding down and moving the wheel button). dired.c: win9x support. eval.c: doc comment about gcpro'ing in record_unwind_protect. frame-msw.c: typo. frame.c: avoid problems with errors during init_frame_3. process-nt.c: remove unused mswindows-quote-process-args. rec for 21.4. unexcw.c: use do/while. autoload.el: Oops, off by one argument. mouse.el: Add an argument to mouse-track so that hooks can be overridden. (let-binding doesn't work when the hooks have been made local.) modify mouse-track-run-hook accordingly, and fix mouse-track-default and mouse-track-insert to use the new functionality. printer.el: Oops, off by one paren.
author ben
date Sun, 20 May 2001 01:17:16 +0000
parents 9a775fb11bb7
children ed498ef2108b
line wrap: on
line diff
--- a/src/frame.c	Fri May 18 04:39:44 2001 +0000
+++ b/src/frame.c	Sun May 20 01:17:16 2001 +0000
@@ -336,6 +336,15 @@
   return foolist;
 }
 
+Lisp_Object
+restore_frame_list_to_its_unbesmirched_state (Lisp_Object kawnz)
+{
+  Lisp_Object lissed = XCDR (kawnz);
+  if (!EQ (lissed, Qunbound))
+    DEVICE_FRAME_LIST (XDEVICE (XCAR (kawnz))) = lissed;
+  return Qnil;
+}    
+
 DEFUN ("make-frame", Fmake_frame, 0, 2, "", /*
 Create and return a new frame, displaying the current buffer.
 Runs the functions listed in `create-frame-hook' after frame creation.
@@ -354,9 +363,10 @@
   struct device *d;
   Lisp_Object frame = Qnil, name = Qnil, minibuf;
   struct gcpro gcpro1, gcpro2, gcpro3;
-  int speccount = specpdl_depth ();
+  int speccount = specpdl_depth (), speccount2;
   int first_frame_on_device = 0;
   int first_frame_on_console = 0;
+  Lisp_Object besmirched_cons = Qnil;
 
   d = decode_device (device);
   XSETDEVICE (device, d);
@@ -432,6 +442,14 @@
   if (NILP (DEVICE_FRAME_LIST (d)))
     first_frame_on_device = 1;
 
+  /* It's possible for one of the init methods below to signal an error;
+     in that case, let's make sure the device isn't besmirched by
+     having a half-initialized frame attached to it */
+  speccount2 = specpdl_depth ();
+  record_unwind_protect (restore_frame_list_to_its_unbesmirched_state,
+			 besmirched_cons =
+			 Fcons (device, DEVICE_FRAME_LIST (d)));
+
   /* This *must* go before the init_*() methods.  Those functions
      call Lisp code, and if any of them causes a warning to be displayed
      and the *Warnings* buffer to be created, it won't get added to
@@ -479,6 +497,10 @@
   /* Hallelujah, praise the lord. */
   f->init_finished = 1;
 
+  XCDR (besmirched_cons) = Qunbound;
+
+  unbind_to (speccount2, Qnil);
+
   /* If this is the first frame on the device, make it the selected one. */
   if (first_frame_on_device && NILP (DEVICE_SELECTED_FRAME (d)))
     set_device_selected_frame (d, frame);