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

index db2355e5f8087099c0837838e85e283226075889..94c06476b01604fed4e173d19bd8fbd564a53198 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())