# HG changeset patch # User John W. Eaton # Date 1597549286 14400 # Node ID 7bdd127d77e5f8df27c7b3afdeb16c4ea149bd8c # Parent 174dc4519e7394e3fae5e8db6266e2fba5825cdd# Parent d075c2f26d1d2b237ab57d6fc3c4447257d38551 maint: merge stable to default. diff -r 174dc4519e73 -r 7bdd127d77e5 libinterp/corefcn/interpreter.cc --- a/libinterp/corefcn/interpreter.cc Fri Aug 14 14:15:50 2020 -0700 +++ b/libinterp/corefcn/interpreter.cc Sat Aug 15 23:41:26 2020 -0400 @@ -872,7 +872,11 @@ // Clear all functions and variables. - OCTAVE_SAFE_CALL (clear_all, (true)); + // Note that we don't force symbols to be cleared, so we will + // respect mlock at this point. Later, we'll force all variables + // and functions to be cleared. + + OCTAVE_SAFE_CALL (clear_all, ()); // We may still have some figures. Close them. @@ -885,7 +889,11 @@ // endless. At some point, we have to give up and force execution // to end. - OCTAVE_SAFE_CALL (clear_all, (true)); + // Note that we again don't force symbols to be cleared, so we + // continue to respect mlock here. Later, we'll force all variables + // and functions to be cleared. + + OCTAVE_SAFE_CALL (clear_all, ()); // Do this explicitly so that destructors for mex file objects // are called, so that functions registered with mexAtExit are @@ -900,6 +908,13 @@ if (! command_history::ignoring_entries ()) OCTAVE_SAFE_CALL (command_history::clean_up_and_save, ()); + OCTAVE_SAFE_CALL (m_gtk_manager.unload_all_toolkits, ()); + + // Now that the graphics toolkits have been unloaded, force all + // symbols to be cleared. + + OCTAVE_SAFE_CALL (clear_all, (true)); + // FIXME: May still need something like this to ensure that // destructors for class objects will run properly. Should that be // done earlier? Before or after atexit functions are executed? @@ -908,8 +923,6 @@ OCTAVE_SAFE_CALL (m_symbol_table.cleanup, ()); - OCTAVE_SAFE_CALL (m_gtk_manager.unload_all_toolkits, ()); - OCTAVE_SAFE_CALL (sysdep_cleanup, ()); OCTAVE_SAFE_CALL (flush_stdout, ());