From: eap Date: Fri, 14 Dec 2012 13:25:12 +0000 (+0000) Subject: 21948: EDF SMESH : Memory is not freed when deleting a mesh X-Git-Tag: pluginMGCleaner~258 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7973c25121390ec469be0d4105ba04d0249b141f;p=modules%2Fsmesh.git 21948: EDF SMESH : Memory is not freed when deleting a mesh In DeleteEventListener() fix removal of listeners --- diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx index 5fae7685a..42be92b04 100644 --- a/src/SMESH/SMESH_subMesh.cxx +++ b/src/SMESH/SMESH_subMesh.cxx @@ -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 ); } }