fix removing from the std::map being iterated over

This commit is contained in:
eap 2010-08-19 09:21:03 +00:00
parent 3a69b3ea0f
commit 14c9e5320c

View File

@ -204,13 +204,16 @@ namespace SMESH
}
}
TVisualObjCont::iterator anIter = VISUAL_OBJ_CONT.begin();
for ( ; anIter != VISUAL_OBJ_CONT.end(); ++anIter ) {
for ( ; anIter != VISUAL_OBJ_CONT.end(); ) {
int curId = anIter->first.first;
if ( curId == studyID ) {
// for unknown reason, object destructor is not called, so clear object manually
anIter->second->GetUnstructuredGrid()->SetCells(0,0,0);
anIter->second->GetUnstructuredGrid()->SetPoints(0);
VISUAL_OBJ_CONT.erase( anIter-- ); // dercement occures before erase()
VISUAL_OBJ_CONT.erase( anIter++ ); // anIter++ returns a copy of self before incrementing
}
else {
anIter++;
}
}
}