21948: EDF SMESH : Memory is not freed when deleting a mesh

In DeleteEventListener() fix removal of listeners
This commit is contained in:
eap 2012-12-14 13:25:12 +00:00
parent 413fec58c7
commit 7973c25121

View 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() )
if ( l_d != _eventListeners.end() && l_d->first )
{
l_d->first->BeforeDelete( this, l_d->second );
delete l_d->first;
}
if ( l_d->second && l_d->second->IsDeletable() )
{
delete l_d->second;
}
_eventListeners.erase( l_d );
if ( l_d->first && !l_d->first->IsDeletable() )
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 );
}
}