diff src/device.c @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents af57a77cbc92
children e38acbeb1cae
line wrap: on
line diff
--- a/src/device.c	Fri Mar 08 13:33:14 2002 +0000
+++ b/src/device.c	Wed Mar 13 08:54:06 2002 +0000
@@ -597,7 +597,7 @@
   setup_device_initial_specifier_tags (d);
 
   UNGCPRO;
-  unbind_to(speccount, Qnil);
+  unbind_to (speccount);
   return device;
 }
 
@@ -1206,19 +1206,28 @@
 #endif
 }
 
+static Lisp_Object
+unlock_device (Lisp_Object d)
+{
+  UNLOCK_DEVICE (XDEVICE (d));
+  return Qnil;
+}
+
 void
 call_critical_lisp_code (struct device *d, Lisp_Object function,
 			 Lisp_Object object)
 {
-  int old_gc_currently_forbidden = gc_currently_forbidden;
-  Lisp_Object old_inhibit_quit = Vinhibit_quit;
+  int count = begin_gc_forbidden ();
+  specbind (Qinhibit_quit, Qt);
+  record_unwind_protect (unlock_device, wrap_device (d));
 
-  /* There's no reason to bother doing specbinds here, because if
+  /* [[There's no real reason to bother doing unwind-protects, because if
      initialize-*-faces signals an error, emacs is going to crash
-     immediately.
+     immediately.]] But this sucks!  This code is called not only during
+     the initial device, but for other devices as well!  #### When dealing
+     with non-initial devices, we should signal an error but NOT kill
+     ourselves! --ben
      */
-  gc_currently_forbidden = 1;
-  Vinhibit_quit = Qt;
   LOCK_DEVICE (d);
 
   /* But it's useful to have an error handler; otherwise an infinite
@@ -1228,9 +1237,7 @@
   else
     call0_with_handler (Qreally_early_error_handler, function);
 
-  UNLOCK_DEVICE (d);
-  Vinhibit_quit = old_inhibit_quit;
-  gc_currently_forbidden = old_gc_currently_forbidden;
+  unbind_to (count);
 }