changeset 23460:b605146ed2ed

do sysdep init and init global vars in app, not interpreter (bug #50880) * libinterp/corefcn/interpreter.cc (interpreter::interpreter): Move calls to systep_init and install_defaults from here to application initialization. * libgui/octave-gui.cc (gui_application::gui_application): Call systep_init and install_defaults here. * libinterp/octave.cc (application::init): Call systep_init and install_defaults here.
author John W. Eaton <jwe@octave.org>
date Tue, 02 May 2017 17:18:02 -0400
parents ddcbf10c8c39
children 8befed6e9ccc
files libgui/src/octave-gui.cc libgui/src/octave-gui.h libinterp/corefcn/interpreter.cc libinterp/octave.cc
diffstat 4 files changed, 19 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/octave-gui.cc	Fri Apr 28 17:20:13 2017 -0700
+++ b/libgui/src/octave-gui.cc	Tue May 02 17:18:02 2017 -0400
@@ -44,6 +44,7 @@
 #include "oct-syscalls.h"
 
 #include "builtin-defun-decls.h"
+#include "defaults.h"
 #include "display.h"
 #if defined (HAVE_QT_GRAPHICS)
 #  include "__init_qt__.h"
@@ -71,6 +72,17 @@
 
 namespace octave
 {
+  gui_application::gui_application (int argc, char **argv)
+    : application (argc, argv), m_argc (argc), m_argv (argv),
+      m_gui_running (false)
+  {
+    // This should probably happen early.
+    sysdep_init ();
+
+    // Need to have global Vfoo variables defined early.
+    install_defaults ();
+  }
+
   bool gui_application::start_gui_p (void) const
   {
     if (m_options.no_window_system ())
--- a/libgui/src/octave-gui.h	Fri Apr 28 17:20:13 2017 -0700
+++ b/libgui/src/octave-gui.h	Tue May 02 17:18:02 2017 -0400
@@ -31,10 +31,7 @@
   {
   public:
 
-    gui_application (int argc, char **argv)
-      : application (argc, argv), m_argc (argc), m_argv (argv),
-        m_gui_running (false)
-    { }
+    gui_application (int argc, char **argv);
 
     // No copying, at least not yet.
 
--- a/libinterp/corefcn/interpreter.cc	Fri Apr 28 17:20:13 2017 -0700
+++ b/libinterp/corefcn/interpreter.cc	Tue May 02 17:18:02 2017 -0400
@@ -376,12 +376,6 @@
   {
     current_evaluator = m_evaluator;
 
-    // This should probably happen early.
-    sysdep_init ();
-
-    // Need to have global Vfoo variables defined early.
-    install_defaults ();
-
     // Matlab uses "C" locale for LC_NUMERIC class regardless of local setting
     setlocale (LC_NUMERIC, "C");
     setlocale (LC_TIME, "C");
--- a/libinterp/octave.cc	Fri Apr 28 17:20:13 2017 -0700
+++ b/libinterp/octave.cc	Tue May 02 17:18:02 2017 -0400
@@ -430,6 +430,12 @@
     m_is_octave_program = ((m_have_script_file || m_have_eval_option_code)
                            && ! m_options.persist ()
                            && ! m_options.traditional ());
+
+    // This should probably happen early.
+    sysdep_init ();
+
+    // Need to have global Vfoo variables defined early.
+    install_defaults ();
   }
 
   int cli_application::execute (void)