From: vsr Date: Mon, 23 Mar 2009 10:42:07 +0000 (+0000) Subject: 0020224: Segmentation fault on Python clean-up - double deleting of SALOME_Selection... X-Git-Tag: V5_1_1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3749b728fd22431a7f516556fb71d83f5176caef;p=modules%2Fgui.git 0020224: Segmentation fault on Python clean-up - double deleting of SALOME_Selection objects --- diff --git a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx index e50f65e24..8400e90e9 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -126,7 +126,7 @@ SALOME_Selection* SALOME_Selection::GetSelection( SalomeApp_Application* app ) \brief Constructor. \param p parent object */ -SALOME_Selection::SALOME_Selection( QObject* p ) : QObject( p ), mySelMgr( 0 ) +SALOME_Selection::SALOME_Selection( QObject* p ) : QObject( 0 ), mySelMgr( 0 ) { SalomeApp_Application* app = dynamic_cast( p ); if ( app ) { @@ -140,9 +140,12 @@ SALOME_Selection::SALOME_Selection( QObject* p ) : QObject( p ), mySelMgr( 0 ) */ SALOME_Selection::~SALOME_Selection() { - SalomeApp_Application* app = dynamic_cast( parent() ); - if ( app && SelMap.find( app ) != SelMap.end() ) - SelMap.remove( app ); + SalomeApp_Application* app = 0; + QMap::Iterator it; + for ( it = SelMap.begin(); it != SelMap.end() && !app; ++it ) { + if ( it.value() == this ) app = it.key(); + } + if ( app ) SelMap.remove( app ); } /*!