mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-19 00:40:32 +05:00
fix removing from the std::map being iterated over
This commit is contained in:
parent
3a69b3ea0f
commit
14c9e5320c
@ -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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user