if (aReason != theFeature && (aReason)->data()->isValid()) {
if (processFeature(aReason))
aIsModified = true;
- if (aReason->data()->execState() == ModelAPI_StateInvalidArgument)
+ // check validity of aReason once again because it may be removed by dependent feature
+ // (e.g. by SketchPlugin_IntersectionPoint)
+ if (!aReason->data()->isValid() ||
+ aReason->data()->execState() == ModelAPI_StateInvalidArgument)
isReferencedInvalid = true;
}
// searching for the next not used reason
if (aSelAttr) {
ObjectPtr aContext = aSelAttr->context();
// update argument only if the referenced object is ready to use
- if (aContext.get() && !aContext->isDisabled()) {
+ if (aContext.get() && !aContext->isDisabled() && !aSelAttr->isInvalid()) {
if (isReason(theFeature, aContext)) {
if (!aSelAttr->update()) {
bool isObligatory = !aFactory->isNotObligatory(
aState = ModelAPI_StateInvalidArgument;
}
}
- } else if (aContext.get()) {
+ } else if (aContext.get() || aSelAttr->isInvalid()) {
// here it may be not obligatory, but if the reference is wrong, it should not be correct
bool isObligatory = aFactory->isCase(theFeature, theFeature->data()->id(aSel));
if (isObligatory)