In Split(), fix removal from a set being iterated, leading to exception at study restoration if there are intersecting groups

This commit is contained in:
eap 2005-01-26 09:07:48 +00:00
parent 72598d1788
commit 71bc953009

View File

@ -350,14 +350,16 @@ void DriverMED_Family::Split (DriverMED_FamilyPtr by,
{
// Elements
set<const SMDS_MeshElement *>::iterator anIter = by->myElements.begin();
for (; anIter != by->myElements.end(); anIter++)
while ( anIter != by->myElements.end())
{
if (myElements.find(*anIter) != myElements.end())
{
common->myElements.insert(*anIter);
myElements.erase(*anIter);
by->myElements.erase(*anIter);
by->myElements.erase(anIter++);
}
else
anIter++;
}
if (!common->IsEmpty())