Salome HOME
In Split(), fix removal from a set being iterated, leading to exception at study...
authoreap <eap@opencascade.com>
Wed, 26 Jan 2005 09:07:48 +0000 (09:07 +0000)
committereap <eap@opencascade.com>
Wed, 26 Jan 2005 09:07:48 +0000 (09:07 +0000)
src/DriverMED/DriverMED_Family.cxx

index 34ff2c2..d9ff5b2 100644 (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())