comparison libinterp/corefcn/interpreter.cc @ 31039:ecb867dfc8eb stable

Don't shut down interpreter immediately on "execute" (bug #62308). * libinterp/corefcn/interpreter.cc (interpreter::execute): Only shutdown interpreter in cases where a main or server loop was started or in case an exception was thrown. (~interpreter): Shutdown the interpreter here if it wasn't shutdown in the execute function.
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 23 Apr 2022 15:20:18 +0200
parents 076e19eac74a
children 0ee18536ec5c
comparison
equal deleted inserted replaced
31037:39876ea8c588 31039:ecb867dfc8eb
652 652
653 OCTAVE_THREAD_LOCAL interpreter *interpreter::m_instance = nullptr; 653 OCTAVE_THREAD_LOCAL interpreter *interpreter::m_instance = nullptr;
654 654
655 interpreter::~interpreter (void) 655 interpreter::~interpreter (void)
656 { 656 {
657 if (! m_app_context)
658 shutdown ();
659
657 delete m_gh_manager; 660 delete m_gh_manager;
658 } 661 }
659 662
660 void interpreter::intern_nargin (octave_idx_type nargs) 663 void interpreter::intern_nargin (octave_idx_type nargs)
661 { 664 {
904 exit_status = server_loop (); 907 exit_status = server_loop ();
905 } 908 }
906 } 909 }
907 else 910 else
908 exit_status = main_loop (); 911 exit_status = main_loop ();
912
913 shutdown ();
909 } 914 }
910 } 915 }
911 catch (const exit_exception& xe) 916 catch (const exit_exception& xe)
912 { 917 {
913 exit_status = xe.exit_status (); 918 exit_status = xe.exit_status ();
914 } 919
915 920 shutdown ();
916 shutdown (); 921 }
917 922
918 return exit_status; 923 return exit_status;
919 } 924 }
920 925
921 // Call a function with exceptions handled to avoid problems with 926 // Call a function with exceptions handled to avoid problems with