]> 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:42:07 +0000 (10:42 +0000)
committervsr <vsr@opencascade.com>
Mon, 23 Mar 2009 10:42:07 +0000 (10:42 +0000)
src/SALOME_PYQT/SalomePyQt/SalomePyQt.cxx

index e50f65e24e2c1f1b984a60495d43eae00f0a4e47..8400e90e92f9dc9ba949489259536863bfa1b7c1 100644 (file)
@@ -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<SalomeApp_Application*>( 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<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.value() == this ) app = it.key();
+  }
+  if ( app ) SelMap.remove( app );
 }
 
 /*!