Mercurial > octave
diff src/pt-except.cc @ 4793:a62215ab8a03
[project @ 2004-02-20 20:59:34 by jwe]
author | jwe |
---|---|
date | Fri, 20 Feb 2004 20:59:34 +0000 |
parents | 5e2c68946f30 |
children | e35b034d3523 |
line wrap: on
line diff
--- a/src/pt-except.cc Fri Feb 20 18:44:43 2004 +0000 +++ b/src/pt-except.cc Fri Feb 20 20:59:34 2004 +0000 @@ -57,7 +57,27 @@ static void do_catch_code (void *ptr) { - if (octave_interrupt_immediately) + // Is it safe to call OCTAVE_QUIT here? We are already running + // something on the unwind_protect stack, but the element for this + // action would have already been popped from the top of the stack, + // so we should not be attempting to run it again. + + OCTAVE_QUIT; + + // If we are interrupting immediately, or if an interrupt is in + // progress (octave_interrupt_state < 0), then we don't want to run + // the catch code (it should only run on errors, not interrupts). + + // If octave_interrupt_state is positive, an interrupt is pending. + // The only way that could happen would be for the interrupt to + // come in after the OCTAVE_QUIT above and before the if statement + // below -- it's possible, but unlikely. In any case, we should + // probably let the catch code throw the exception because we don't + // want to skip that and potentially run some other code. For + // example, an error may have originally brought us here for some + // cleanup operation and we shouldn't skip that. + + if (octave_interrupt_immediately || octave_interrupt_state < 0) return; tree_statement_list *list = static_cast<tree_statement_list *> (ptr);