From 7973c25121390ec469be0d4105ba04d0249b141f Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 14 Dec 2012 13:25:12 +0000 Subject: [PATCH] 21948: EDF SMESH : Memory is not freed when deleting a mesh In DeleteEventListener() fix removal of listeners --- src/SMESH/SMESH_subMesh.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) 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 ); } } -- 2.39.2