From 024cc13e433d75949a87876aea8908197f88b4f8 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 19 Sep 2005 08:32:07 +0000 Subject: [PATCH] Fix PAL10018: crash SALOME if one Python module is only available in GUI --- src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx index 1d79e16fa..7ee66fef3 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx @@ -18,6 +18,7 @@ #include "QtxWorkstack.h" #include +#include #include #include @@ -94,6 +95,7 @@ private: // While the SalomePyQtGUI library is not imported in Python it's initialization function // should be called manually (and only once) in order to initialize global sip data +// and to get C API from sip : sipBuildResult for example #if defined(SIP_STATIC_MODULE) extern "C" void initSalomePyQtGUI(); #else @@ -109,7 +111,9 @@ extern "C" { static bool alreadyInitialized = false; if ( !alreadyInitialized ) { // call only once (see above) ! + PyEval_RestoreThread( KERNEL_PYTHON::_gtstate ); initSalomePyQtGUI(); + PyEval_ReleaseThread( KERNEL_PYTHON::_gtstate ); alreadyInitialized = !alreadyInitialized; } return new SALOME_PYQT_Module(); -- 2.39.2