Salome HOME
In Split(), fix removal from a set being iterated, leading to exception at study...
[modules/smesh.git] / src / DriverMED / DriverMED_Family.cxx
index 778c282a57572d59dbaeb1ed438f3cdcb0a631cb..d9ff5b249dcc2f766d2e8b65fa093af45b8e520a 100644 (file)
@@ -193,10 +193,10 @@ list<DriverMED_FamilyPtr> DriverMED_Family::MakeFamilies
     aFamilies.push_back(aFreeVolumesFam);
   }
 
-  DriverMED_FamilyPtr aNullFam (new DriverMED_Family);
-  aNullFam->SetId(0);
-  aNullFam->myType = SMDSAbs_All;
-  aFamilies.push_back(aNullFam);
+  //DriverMED_FamilyPtr aNullFam (new DriverMED_Family);
+  //aNullFam->SetId(0);
+  //aNullFam->myType = SMDSAbs_All;
+  //aFamilies.push_back(aNullFam);
 
   return aFamilies;
 }
@@ -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())