changeset 5348:39304a35b6b3

Don't commit suicide when an X device dies. 2011-01-30 Michael Sperber <mike@xemacs.org> * redisplay.h: * redisplay.c: (redisplay_cancel_ritual_suicide): * eval.c (throw_or_bomb_out_unsafe): * device-x.c (x_IO_error_handler): Don't commit suicide when an X device dies.
author Mike Sperber <sperber@deinprogramm.de>
date Sun, 30 Jan 2011 12:20:19 +0100
parents fd441b85d760
children 239193591765
files src/ChangeLog src/device-x.c src/eval.c src/lisp.h src/redisplay.c src/redisplay.h
diffstat 6 files changed, 53 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Jan 23 13:56:37 2011 +0000
+++ b/src/ChangeLog	Sun Jan 30 12:20:19 2011 +0100
@@ -1,3 +1,12 @@
+2011-01-30  Michael Sperber  <mike@xemacs.org>
+
+	* redisplay.h: 
+	* redisplay.c: 
+	(redisplay_cancel_ritual_suicide): 
+	* eval.c (throw_or_bomb_out_unsafe): 
+	* device-x.c (x_IO_error_handler): Don't commit suicide when an X
+	device dies.
+
 2011-01-23  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* file-coding.c (complex_vars_of_file_coding):
--- a/src/device-x.c	Sun Jan 23 13:56:37 2011 +0000
+++ b/src/device-x.c	Sun Jan 30 12:20:19 2011 +0100
@@ -1255,7 +1255,8 @@
       DEVICE_X_BEING_DELETED (d) = 1;
     }
 
-  throw_or_bomb_out (Qtop_level, Qnil, 0, Qnil, Qnil);
+  redisplay_cancel_ritual_suicide();
+  throw_or_bomb_out_unsafe (Qtop_level, Qnil, 0, Qnil, Qnil);
 
   RETURN_NOT_REACHED (0);
 }
--- a/src/eval.c	Sun Jan 23 13:56:37 2011 +0000
+++ b/src/eval.c	Sun Jan 30 12:20:19 2011 +0100
@@ -1802,22 +1802,13 @@
   LONGJMP (c->jmp, 1);
 }
 
-DECLARE_DOESNT_RETURN (throw_or_bomb_out (Lisp_Object, Lisp_Object, int,
+DECLARE_DOESNT_RETURN (throw_or_bomb_out_unsafe (Lisp_Object, Lisp_Object, int,
 					  Lisp_Object, Lisp_Object));
 
 DOESNT_RETURN
-throw_or_bomb_out (Lisp_Object tag, Lisp_Object val, int bomb_out_p,
-		   Lisp_Object sig, Lisp_Object data)
-{
-#ifdef DEFEND_AGAINST_THROW_RECURSION
-  /* die if we recurse more than is reasonable */
-  assert (++throw_level <= 20);
-#endif
-
-#ifdef ERROR_CHECK_TRAPPING_PROBLEMS
-  check_proper_critical_section_nonlocal_exit_protection ();
-#endif
-
+throw_or_bomb_out_unsafe (Lisp_Object tag, Lisp_Object val, int bomb_out_p,
+			  Lisp_Object sig, Lisp_Object data)
+{
   /* If bomb_out_p is t, this is being called from Fsignal as a
      "last resort" when there is no handler for this error and
       the debugger couldn't be invoked, so we are throwing to
@@ -1857,6 +1848,24 @@
         call1 (Qreally_early_error_handler, Fcons (sig, data));
     }
 }
+  
+DECLARE_DOESNT_RETURN (throw_or_bomb_out (Lisp_Object, Lisp_Object, int,
+					  Lisp_Object, Lisp_Object));
+
+DOESNT_RETURN
+throw_or_bomb_out (Lisp_Object tag, Lisp_Object val, int bomb_out_p,
+		   Lisp_Object sig, Lisp_Object data)
+{
+#ifdef DEFEND_AGAINST_THROW_RECURSION
+  /* die if we recurse more than is reasonable */
+  assert (++throw_level <= 20);
+#endif
+
+#ifdef ERROR_CHECK_TRAPPING_PROBLEMS
+  check_proper_critical_section_nonlocal_exit_protection ();
+#endif
+  throw_or_bomb_out_unsafe (tag, val, bomb_out_p, sig, data);
+}
 
 /* See above, where CATCHLIST is defined, for a description of how
    Fthrow() works.
--- a/src/lisp.h	Sun Jan 23 13:56:37 2011 +0000
+++ b/src/lisp.h	Sun Jan 30 12:20:19 2011 +0100
@@ -4722,6 +4722,10 @@
                                                      Lisp_Object, int,
                                                      Lisp_Object, Lisp_Object));
 
+MODULE_API DECLARE_DOESNT_RETURN (throw_or_bomb_out_unsafe (Lisp_Object,
+							    Lisp_Object, int,
+							    Lisp_Object, Lisp_Object));
+
 MODULE_API DECLARE_DOESNT_RETURN (signal_error_1 (Lisp_Object, Lisp_Object));
 void maybe_signal_error_1 (Lisp_Object, Lisp_Object, Lisp_Object,
 			   Error_Behavior);
--- a/src/redisplay.c	Sun Jan 23 13:56:37 2011 +0000
+++ b/src/redisplay.c	Sun Jan 30 12:20:19 2011 +0100
@@ -6688,12 +6688,25 @@
   unbind_to (depth);
 }
 
+static int the_ritual_suicide_has_been_cancelled = 0;
+
+void
+redisplay_cancel_ritual_suicide(void)
+{
+  the_ritual_suicide_has_been_cancelled = 1;
+}
+
 #ifdef ERROR_CHECK_TRAPPING_PROBLEMS
 
 static Lisp_Object
 commit_ritual_suicide (Lisp_Object UNUSED (ceci_nest_pas_une_pipe))
 {
-  assert (!in_display);
+  if (!the_ritual_suicide_has_been_cancelled)
+    {
+      assert (!in_display);
+    }
+  else
+    the_ritual_suicide_has_been_cancelled = 0;
   return Qnil;
 }
 
--- a/src/redisplay.h	Sun Jan 23 13:56:37 2011 +0000
+++ b/src/redisplay.h	Sun Jan 30 12:20:19 2011 +0100
@@ -848,4 +848,6 @@
 int enter_redisplay_critical_section_if (Boolint from_outside);
 void exit_redisplay_critical_section_if (Boolint from_outside, int depth);
 
+void redisplay_cancel_ritual_suicide(void);
+
 #endif /* INCLUDED_redisplay_h_ */