From 920b19fdf0bf261108c246fcbf02a9d81df57335 Mon Sep 17 00:00:00 2001 From: vsr Date: Fri, 27 Feb 2009 16:33:56 +0000 Subject: [PATCH] Issue 0020165: fix crash on new study creation when single Python module is in the session --- .../SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx | 13 +++++++++++++ .../SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.h | 1 + src/SalomeApp/SalomeApp_PyInterp.cxx | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx index 15d152860..5d2228cd1 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx @@ -39,6 +39,19 @@ SALOME_PYQT_PyInterp::~SALOME_PYQT_PyInterp() { } +void SALOME_PYQT_PyInterp::initPython() +{ + /* + * Do nothing + * The initialization has been done in main + */ + MESSAGE("SALOME_PYQT_PyInterp::initPython"); + ASSERT(KERNEL_PYTHON::_gtstate); // initialisation in main + SCRUTE(KERNEL_PYTHON::_gtstate); + _gtstate=KERNEL_PYTHON::_gtstate; + _interp=KERNEL_PYTHON::_interp; +} + bool SALOME_PYQT_PyInterp::initState() { /* diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.h b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.h index 3daf66664..a53ee7264 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.h +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.h @@ -38,6 +38,7 @@ public: int run( const char* ); protected: + virtual void initPython(); virtual bool initState(); virtual bool initContext(); }; diff --git a/src/SalomeApp/SalomeApp_PyInterp.cxx b/src/SalomeApp/SalomeApp_PyInterp.cxx index b60117d08..27d520f6f 100755 --- a/src/SalomeApp/SalomeApp_PyInterp.cxx +++ b/src/SalomeApp/SalomeApp_PyInterp.cxx @@ -110,7 +110,7 @@ bool SalomeApp_PyInterp::initContext() */ void SalomeApp_PyInterp::initPython() { - MESSAGE("PyInterp_base::initPython"); + MESSAGE("SalomeApp_PyInterp::initPython"); ASSERT(KERNEL_PYTHON::_gtstate); // initialisation in main SCRUTE(KERNEL_PYTHON::_gtstate); _gtstate=KERNEL_PYTHON::_gtstate; -- 2.39.2