From: azv Date: Fri, 20 Mar 2015 08:23:12 +0000 (+0300) Subject: Issue #412: Crash on delete sketch line with constraints X-Git-Tag: V_1.1.0~100 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=074b1d850036614d4a08999c4bc4e8630db63d2b;p=modules%2Fshaper.git Issue #412: Crash on delete sketch line with constraints Avoid removing from the sketch all points used in coincidence constraint --- diff --git a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp index f8470401a..237d2dc24 100644 --- a/src/SketchSolver/SketchSolver_ConstraintGroup.cpp +++ b/src/SketchSolver/SketchSolver_ConstraintGroup.cpp @@ -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::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())