diff --git a/libinterp/octave-value/ov-oncleanup.cc b/libinterp/octave-value/ov-oncleanup.cc --- a/libinterp/octave-value/ov-oncleanup.cc +++ b/libinterp/octave-value/ov-oncleanup.cc @@ -76,6 +76,8 @@ octave_oncleanup::~octave_oncleanup (voi frame.protect_var (quit_allowed); quit_allowed = false; + interpreter_try (frame); + try { // Run the actual code. @@ -89,12 +91,12 @@ octave_oncleanup::~octave_oncleanup (voi } catch (const octave_execution_exception&) { - throw; + warning ("onCleanup: error caught while executing cleanup function"); } catch (...) // Yes, the black hole. We're in a d-tor. { // This shouldn't happen, in theory. - error ("onCleanup: internal error: unhandled exception in cleanup action"); + warning ("onCleanup: internal error: unhandled exception in cleanup action"); } }