From 4112a0eac034d7240db481600aacbfb07dcc20cc Mon Sep 17 00:00:00 2001 From: Artem Zhidkov Date: Mon, 8 Jun 2020 10:24:25 +0300 Subject: [PATCH] Issue #19187: B-Splines - Crash with specific scenario Fix the regression related to the previous change. Improve the validator of the Tangent constraint. --- src/SketchPlugin/SketchPlugin_Validators.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/SketchPlugin/SketchPlugin_Validators.cpp b/src/SketchPlugin/SketchPlugin_Validators.cpp index f3543bc29..9feba7df8 100644 --- a/src/SketchPlugin/SketchPlugin_Validators.cpp +++ b/src/SketchPlugin/SketchPlugin_Validators.cpp @@ -231,9 +231,6 @@ bool SketchPlugin_TangentAttrValidator::isValid(const AttributePtr& theAttribute std::set aCoincidences = SketchPlugin_Tools::findCoincidentConstraints(aRefFea); for (std::set::iterator anIt = aCoincidences.begin(); anIt != aCoincidences.end() && !isValid; ++anIt) { - if ((*anIt)->getKind() == SketchPlugin_ConstraintCoincidenceInternal::ID()) - continue; // skip internal constraints - std::set aCoinc; if (isApplicableCoincidence(*anIt, SketchPlugin_Constraint::ENTITY_A())) SketchPlugin_Tools::findCoincidences(*anIt, SketchPlugin_Constraint::ENTITY_B(), @@ -242,7 +239,13 @@ bool SketchPlugin_TangentAttrValidator::isValid(const AttributePtr& theAttribute SketchPlugin_Tools::findCoincidences(*anIt, SketchPlugin_Constraint::ENTITY_A(), aCoinc, true); - isValid = aCoinc.find(aOtherFea) != aCoinc.end(); + std::set::iterator aFoundCoinc = aCoinc.find(aOtherFea); + if (aFoundCoinc != aCoinc.end()) { + // do not take into account internal constraints + AttributeReferencePtr aParent = + (*aFoundCoinc)->reference(SketchPlugin_SketchEntity::PARENT_ID()); + isValid = !aParent || !aParent->isInitialized() || aParent->value() != aRefFea; + } } } -- 2.39.2