From ddbd8e0fb3c86a861d7c674bfb607599ac5a3fe2 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 23 Mar 2009 10:44:48 +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 373bd6f34..dee7dd661 100644 --- a/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx +++ b/src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx @@ -102,7 +102,7 @@ SALOME_Selection* SALOME_Selection::GetSelection( SalomeApp_Application* app ) /*! Selection constructor. */ -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 ) { @@ -116,9 +116,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.data() == this ) app = it.key(); + } + if ( app ) SelMap.remove( app ); } /*! -- 2.39.2