From: vsr Date: Mon, 19 Oct 2009 08:10:58 +0000 (+0000) Subject: Issue 0020536: EDF 1136 GUI: SIGSEGV for Python module if import process of GUI compo... X-Git-Tag: V4_1_0_maintainance_FINAL X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=eddd256ce45279267b438f9e2260e5b8e73fad9c;p=modules%2Fgui.git Issue 0020536: EDF 1136 GUI: SIGSEGV for Python module if import process of GUI component raises an exception --- 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 35c178b97..d3aa08926 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx @@ -195,6 +195,10 @@ SALOME_PYQT_Module::~SALOME_PYQT_Module() { if ( myXmlHandler ) delete myXmlHandler; + if ( myInterp && myModule ) { + PyLockWrapper aLock = myInterp->GetLockWrapper(); + Py_XDECREF(myModule); + } } /*! @@ -834,13 +838,17 @@ void SALOME_PYQT_Module::activate( SUIT_Study* theStudy ) // initialize Python subinterpreter (on per study) and put it in variable initInterp( aStudyId ); - if ( !myInterp ) + if ( !myInterp ) { + myLastActivateStatus = false; return; // Error + } // import Python GUI module importModule(); - if ( !myModule ) + if ( !myModule ) { + myLastActivateStatus = false; return; // Error + } // get python lock PyLockWrapper aLock = myInterp->GetLockWrapper(); diff --git a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h index beeb04b7b..b51ec51d7 100644 --- a/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h +++ b/src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.h @@ -54,7 +54,7 @@ private: /* current Python subinterpreter */ SALOME_PYQT_PyInterp* myInterp; /* Python GUI module loaded */ - PyObjWrapper myModule; + PyObject* myModule; /* Python GUI being initialized (not zero only during the initialization)*/ static SALOME_PYQT_Module* myInitModule;