From 966d23b781d6f6431b07d11c69bb6c38bfdf3051 Mon Sep 17 00:00:00 2001 From: prascle Date: Fri, 14 May 2004 10:12:09 +0000 Subject: [PATCH] PR: bug KERNEL 5852 --- src/SALOMEGUI/PyInterp_PyQt.cxx | 2 +- src/SALOMEGUI/PyInterp_base.cxx | 23 +++++++++++++++-------- src/SALOME_PYQT/SALOME_PYQT_GUI.cxx | 14 +++++++++----- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/SALOMEGUI/PyInterp_PyQt.cxx b/src/SALOMEGUI/PyInterp_PyQt.cxx index ae688800f..dd136e506 100644 --- a/src/SALOMEGUI/PyInterp_PyQt.cxx +++ b/src/SALOMEGUI/PyInterp_PyQt.cxx @@ -20,7 +20,7 @@ using namespace std; * calls initialize method defined in base class, which calls virtual methods * initstate & initcontext redefined here */ -PyInterp_PyQt::PyInterp_PyQt() +PyInterp_PyQt::PyInterp_PyQt(): PyInterp_base() { initialize(); } diff --git a/src/SALOMEGUI/PyInterp_base.cxx b/src/SALOMEGUI/PyInterp_base.cxx index 032be6aeb..e16f1e041 100644 --- a/src/SALOMEGUI/PyInterp_base.cxx +++ b/src/SALOMEGUI/PyInterp_base.cxx @@ -128,23 +128,30 @@ void PyInterp_base::initialize() _history.clear(); // start a new list of user's commands _ith = _history.begin(); - PyReleaseLock aReleaseLock; if(!_gtstate){ + PyReleaseLock aReleaseLock; Py_Initialize(); // Initialize the interpreter PyEval_InitThreads(); // Initialize and acquire the global interpreter lock PySys_SetArgv(_argc,_argv); // initialize sys.argv _gtstate = PyThreadState_Get(); + + /* + * salome_shared_modules should be imported only once + */ + salome_shared_modules_module = PyImport_ImportModule("salome_shared_modules"); + if(!salome_shared_modules_module) + { + INFOS("PyInterp_base::initialize() - salome_shared_modules_module == NULL"); + PyErr_Print(); + PyErr_Clear(); + } } + // Here the global lock is released if(MYPYDEBUG) MESSAGE("PyInterp_base::initialize() - this = "<getActiveApp()->getActiveStudy()->getStudyId(); + MESSAGE("SALOME_PYQT_GUI::ActiveStudyChanged"<GetLockWrapper(); -- 2.39.2