]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
21948: EDF SMESH : Memory is not freed when deleting a mesh
authoreap <eap@opencascade.com>
Fri, 14 Dec 2012 13:25:12 +0000 (13:25 +0000)
committereap <eap@opencascade.com>
Fri, 14 Dec 2012 13:25:12 +0000 (13:25 +0000)
In DeleteEventListener() fix removal of listeners

src/SMESH/SMESH_subMesh.cxx

index 5fae7685a7366585561cef3adcfe92958d9b9de2..42be92b04501682d8619b29739430134664c4b11 100644 (file)
@@ -2192,20 +2192,19 @@ void SMESH_subMesh::DeleteEventListener(EventListener* listener)
 {
   map< EventListener*, EventListenerData* >::iterator l_d =
     _eventListeners.find( listener );
-  if ( l_d != _eventListeners.end() ) {
-    if ( l_d->first && l_d->first->IsDeletable() )
-    {
-      l_d->first->BeforeDelete( this, l_d->second );
-      delete l_d->first;
-    }
+  if ( l_d != _eventListeners.end() && l_d->first )
+  {
     if ( l_d->second && l_d->second->IsDeletable() )
     {
       delete l_d->second;
     }
+    l_d->first->myBusySM.erase( this );
+    if ( l_d->first->IsDeletable() )
+    {
+      l_d->first->BeforeDelete( this, l_d->second );
+      delete l_d->first;
+    }
     _eventListeners.erase( l_d );
-
-    if ( l_d->first && !l_d->first->IsDeletable() )
-      l_d->first->myBusySM.erase( this );
   }
 }