]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
[bos #29933] [CEA 29931] Redundant constraint in SHAPER SIGSEGV
authorjfa <jfa@opencascade.com>
Wed, 11 May 2022 14:44:06 +0000 (17:44 +0300)
committerjfa <jfa@opencascade.com>
Wed, 11 May 2022 14:44:06 +0000 (17:44 +0300)
src/PartSet/PartSet_OverconstraintListener.cpp

index 5db78193f6a92f367f127386aa3415f9668404ea..74b1bde5a0a8dc945b4c72500d3c1522c9bdecf8 100644 (file)
@@ -238,12 +238,11 @@ void PartSet_OverconstraintListener::processEvent(const std::shared_ptr<Events_M
     if (aConstraintsMsg.get()) {
       myObjectsToRemove = aConstraintsMsg->constraints();
 
-      std::set<ObjectPtr>::const_iterator
-        anIt = myObjectsToRemove.begin(), aLast = myObjectsToRemove.end();
+      std::set<ObjectPtr>::const_iterator anIt = myObjectsToRemove.begin();
 
       PartSet_Module* aModule = dynamic_cast<PartSet_Module*>(myWorkshop->module());
 
-      for (; anIt != aLast; anIt++)
+      for (; anIt != myObjectsToRemove.end(); )
       {
         ObjectPtr anObject = *anIt;
         FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObject);
@@ -251,7 +250,9 @@ void PartSet_OverconstraintListener::processEvent(const std::shared_ptr<Events_M
         if ((aType == SketchPlugin_ConstraintHorizontal::ID() ||
              aType == SketchPlugin_ConstraintVertical::ID()) &&
              !aModule->sketchReentranceMgr()->isLastAutoConstraint(*anIt))
-          myObjectsToRemove.erase(*anIt);
+          anIt = myObjectsToRemove.erase(anIt);
+        else
+          anIt++;
       }
 
       if (myObjectsToRemove.empty())