From 55c079c727980f06d404d528ab528372a0870090 Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 24 Jun 2015 12:17:09 +0300 Subject: [PATCH] Fix for the issue #665 --- src/InitializationPlugin/InitializationPlugin_Plugin.cpp | 6 ++++++ src/ModelAPI/ModelAPI_Feature.cpp | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/InitializationPlugin/InitializationPlugin_Plugin.cpp b/src/InitializationPlugin/InitializationPlugin_Plugin.cpp index f3ef02d96..654b9c446 100644 --- a/src/InitializationPlugin/InitializationPlugin_Plugin.cpp +++ b/src/InitializationPlugin/InitializationPlugin_Plugin.cpp @@ -102,6 +102,10 @@ FeaturePtr InitializationPlugin_Plugin::createPlane(DocumentPtr theDoc, double t // the plane should be executed in order to build the feature result immediatelly // the results are to be hidden in the plugin aPlane->execute(); + // this flag is needed here to avoid setting it inside of the next transaction + // (may cause crash on redo of the first transaction in OCAF) + aPlane->data()->execState(ModelAPI_StateDone); + aPlane->firstResult()->data()->execState(ModelAPI_StateDone); return aPlane; } @@ -118,6 +122,8 @@ FeaturePtr InitializationPlugin_Plugin::createPoint(DocumentPtr theDoc) // the point should be executed in order to build the feature result immediatelly // the results are to be hidden in the plugin aPoint->execute(); + aPoint->data()->execState(ModelAPI_StateDone); + aPoint->firstResult()->data()->execState(ModelAPI_StateDone); return aPoint; } diff --git a/src/ModelAPI/ModelAPI_Feature.cpp b/src/ModelAPI/ModelAPI_Feature.cpp index 3ba486be3..3c78c82d0 100644 --- a/src/ModelAPI/ModelAPI_Feature.cpp +++ b/src/ModelAPI/ModelAPI_Feature.cpp @@ -146,7 +146,8 @@ void ModelAPI_Feature::erase() while (!myResults.empty()) { // remove one by one with messages std::shared_ptr aRes = *(myResults.begin()); aRes->setDisabled(aRes, true); // to avoid activation of the Part result - myResults.erase(myResults.begin()); + if (!myResults.empty()) // disabling result may erase the list (on undo of Part, issue 665) + myResults.erase(myResults.begin()); } ModelAPI_Object::erase(); } -- 2.39.2