From 3749b728fd22431a7f516556fb71d83f5176caef Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 23 Mar 2009 10:42:07 +0000 Subject: [PATCH] 0020224: Segmentation fault on Python clean-up - double deleting of SALOME_Selection objects --- src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 ); } /*! -- 2.39.2