Salome HOME
Fix for the problem when referenced object is updated by modified-feature result...
authormpv <mpv@opencascade.com>
Fri, 20 Jul 2018 13:50:04 +0000 (16:50 +0300)
committermpv <mpv@opencascade.com>
Fri, 20 Jul 2018 13:50:16 +0000 (16:50 +0300)
An example:
Box
Polyline on a box vertices
Move history to the box
Make another polyline on a box
Move history to the end -> crash

src/Model/Model_Update.cpp

index c0a791e26322adb672972c235278ab6e399db981..05a9998d837bbb127b30c31ac007a0f779d66395 100755 (executable)
@@ -836,7 +836,7 @@ void Model_Update::updateArguments(FeaturePtr theFeature) {
       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(
@@ -846,7 +846,7 @@ void Model_Update::updateArguments(FeaturePtr theFeature) {
                 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)