]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
0020224: Segmentation fault on Python clean-up - double deleting of SALOME_Selection...
authorvsr <vsr@opencascade.com>
Mon, 23 Mar 2009 10:44:48 +0000 (10:44 +0000)
committervsr <vsr@opencascade.com>
Mon, 23 Mar 2009 10:44:48 +0000 (10:44 +0000)
src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx

index 373bd6f3477ac6c2a617673918b0a77ca671f623..dee7dd661a2fa34563e9a5808cbfe54f6efe0af4 100644 (file)
@@ -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<SalomeApp_Application*>( 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<SalomeApp_Application*>( parent() );
-  if ( app && SelMap.find( app ) != SelMap.end() )
-    SelMap.remove( app );
+  SalomeApp_Application* app = 0;
+  QMap<SalomeApp_Application*, SALOME_Selection*>::Iterator it;
+  for ( it = SelMap.begin(); it != SelMap.end() && !app; ++it ) {
+    if ( it.data() == this ) app = it.key();
+  }
+  if ( app ) SelMap.remove( app );
 }
 
 /*!