changeset 30736:dadbfe6fddd6 stable

don't perform interpreter shutdown actions in destructor (bug #61994) * interpreter.cc (interpreter::~interpreter): Don't call shutdown. (interpreter::execute): Call shutdown before returning. (interpreter::shutdown): Now private.
author John W. Eaton <jwe@octave.org>
date Sat, 12 Feb 2022 14:19:17 -0500
parents fb0d6b1e0b64
children 7ee1ec5753c1 3c4368f0a4ab
files libinterp/corefcn/interpreter.cc libinterp/corefcn/interpreter.h
diffstat 2 files changed, 14 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc	Sat Feb 12 12:23:23 2022 -0500
+++ b/libinterp/corefcn/interpreter.cc	Sat Feb 12 14:19:17 2022 -0500
@@ -654,8 +654,6 @@
 
   interpreter::~interpreter (void)
   {
-    shutdown ();
-
     delete m_gh_manager;
   }
 
@@ -854,7 +852,11 @@
                   exit_status = status;
 
                 if (! options.persist ())
-                  return exit_status;
+                  {
+                    shutdown ();
+
+                    return exit_status;
+                  }
               }
 
             // If there is an extra argument, see if it names a file to
@@ -869,7 +871,11 @@
                   exit_status = status;
 
                 if (! options.persist ())
-                  return exit_status;
+                  {
+                    shutdown ();
+
+                    return exit_status;
+                  }
               }
 
             if (options.forced_interactive ())
@@ -907,6 +913,8 @@
         exit_status = xe.exit_status ();
       }
 
+    shutdown ();
+
     return exit_status;
   }
 
--- a/libinterp/corefcn/interpreter.h	Sat Feb 12 12:23:23 2022 -0500
+++ b/libinterp/corefcn/interpreter.h	Sat Feb 12 14:19:17 2022 -0500
@@ -166,8 +166,6 @@
 
     int execute (void);
 
-    void shutdown (void);
-
     bool server_mode (void) const { return m_evaluator.server_mode (); }
 
     bool interactive (void) const
@@ -578,6 +576,8 @@
 
     int server_loop (void);
 
+    void shutdown (void);
+
     void execute_atexit_fcns (void);
 
     void maximum_braindamage (void);