Mercurial > octave
changeset 27481:458adc344819
avoid possible crash due to execution_exception in GUI thread
* GLCanvas.cc (GLCanvas::do_print): Use throw with captured exception
object instead of std::rethrow_exception (std::current_exception ()).
* octave-qobject.cc (octave_qapplication::notify): Likewise.
* oct-parse.yy (parser::run): Simply rethrow execution_exception
instead of trying to convert to parse error.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 07 Oct 2019 14:36:01 -0400 |
parents | 63b417917f5e |
children | 94d278b130d1 |
files | libgui/graphics/GLCanvas.cc libgui/src/octave-qobject.cc libinterp/parse-tree/oct-parse.yy |
diffstat | 3 files changed, 15 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/graphics/GLCanvas.cc Sun Oct 06 16:30:35 2019 -0400 +++ b/libgui/graphics/GLCanvas.cc Mon Oct 07 14:36:01 2019 -0400 @@ -180,14 +180,14 @@ fbo.release (); } } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { emit interpreter_event - ([] (void) + ([ee] (void) { // INTERPRETER THREAD - std::rethrow_exception (std::current_exception ()); + throw ee; }); }
--- a/libgui/src/octave-qobject.cc Sun Oct 06 16:30:35 2019 -0400 +++ b/libgui/src/octave-qobject.cc Mon Oct 07 14:36:01 2019 -0400 @@ -68,14 +68,14 @@ { return QApplication::notify (receiver, ev); } - catch (execution_exception&) + catch (execution_exception& ee) { emit interpreter_event - ([] (void) + ([ee] (void) { // INTERPRETER THREAD - std::rethrow_exception (std::current_exception ()); + throw ee; }); }
--- a/libinterp/parse-tree/oct-parse.yy Sun Oct 06 16:30:35 2019 -0400 +++ b/libinterp/parse-tree/oct-parse.yy Mon Oct 07 14:36:01 2019 -0400 @@ -4411,20 +4411,21 @@ { status = octave_pull_parse (pstate, *this); } - catch (execution_exception& e) + catch (const execution_exception&) { - std::string file = m_lexer.m_fcn_file_full_name; - - if (file.empty ()) - error (e, "parse error"); - else - error (e, "parse error in %s", file.c_str ()); + // FIXME: In previous versions, we emitted a parse error here + // but that is not always correct because the error could have + // happened inside a GUI callback functions executing in the + // readline event_hook loop. Maybe we need a separate exception + // class for parse errors? + + throw; } catch (const exit_exception&) { throw; } - catch (interrupt_exception &) + catch (const interrupt_exception&) { throw; }