# HG changeset patch # User Mike Sperber # Date 1296386419 -3600 # Node ID 39304a35b6b39ac22c1c09b4bbcc5b4512f577a3 # Parent fd441b85d76087b9b14340ff1ed090b3c3abc1da Don't commit suicide when an X device dies. 2011-01-30 Michael Sperber * 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. diff -r fd441b85d760 -r 39304a35b6b3 src/ChangeLog --- 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 + + * 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 * file-coding.c (complex_vars_of_file_coding): diff -r fd441b85d760 -r 39304a35b6b3 src/device-x.c --- 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); } diff -r fd441b85d760 -r 39304a35b6b3 src/eval.c --- 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. diff -r fd441b85d760 -r 39304a35b6b3 src/lisp.h --- 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); diff -r fd441b85d760 -r 39304a35b6b3 src/redisplay.c --- 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; } diff -r fd441b85d760 -r 39304a35b6b3 src/redisplay.h --- 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_ */