]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #412: Crash on delete sketch line with constraints
authorazv <azv@opencascade.com>
Fri, 20 Mar 2015 08:23:12 +0000 (11:23 +0300)
committerazv <azv@opencascade.com>
Fri, 20 Mar 2015 08:23:12 +0000 (11:23 +0300)
Avoid removing from the sketch all points used in coincidence constraint

src/SketchSolver/SketchSolver_ConstraintGroup.cpp

index f8470401ab0eaf5a10076fd152cdc17b14fe4707..237d2dc2473ae4d3cd01c96520af95a9ed33962d 100644 (file)
@@ -1911,19 +1911,26 @@ void SketchSolver_ConstraintGroup::removeConstraint(
         if (anEntToRemove.find(anEntIter->point[i]) != anEntToRemove.end()) {
           anEntToRemove.insert(anEntIter->h);
           for (int j = 0; j < 4; j++)
-            if (anEntIter->param[j] != 0)
+            if (anEntIter->point[j] != 0)
               anEntToRemove.insert(anEntIter->point[j]);
           break;
         }
     }
 
+  // Find entities used by remaining constraints and remove them from the list to delete
   std::vector<Slvs_Constraint>::const_iterator aConstrIter = myConstraints.begin();
   for (; aConstrIter != myConstraints.end(); aConstrIter++) {
     Slvs_hEntity aEnts[] = { aConstrIter->ptA, aConstrIter->ptB, aConstrIter->entityA, aConstrIter
         ->entityB };
     for (int i = 0; i < 4; i++)
-      if (aEnts[i] != 0 && anEntToRemove.find(aEnts[i]) != anEntToRemove.end())
+      if (aEnts[i] != 0 && anEntToRemove.find(aEnts[i]) != anEntToRemove.end()) {
         anEntToRemove.erase(aEnts[i]);
+        // remove from the list all points of current entity
+        int aEntPos = Search(aEnts[i], myEntities);
+        for (int j = 0; j < 4; j++)
+          if (myEntities[aEntPos].point[j] != 0)
+            anEntToRemove.erase(myEntities[aEntPos].point[j]);
+      }
   }
 
   if (anEntToRemove.empty())