From: vsr Date: Mon, 19 Sep 2005 08:32:07 +0000 (+0000) Subject: Fix PAL10018: crash SALOME if one Python module is only available in GUI X-Git-Tag: V3_1_0a1~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=024cc13e433d75949a87876aea8908197f88b4f8;p=modules%2Fgui.git Fix PAL10018: crash SALOME if one Python module is only available in GUI --- 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();