From a4bd17354dd1dc64335be9fba58dd54d07ae697a Mon Sep 17 00:00:00 2001 From: mpv Date: Wed, 17 Aug 2016 18:01:00 +0300 Subject: [PATCH] Fix for the TestCompositeFeaturesOnCompSolids.py test passing: after commit of nested operation there were possible some operations outside of the transaction (on set of the current feature) in python scripts --- src/Model/Model_Document.cpp | 11 +++++++++++ src/Model/Model_Expression.cpp | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Model/Model_Document.cpp b/src/Model/Model_Document.cpp index c392492fc..61ba6e53f 100755 --- a/src/Model/Model_Document.cpp +++ b/src/Model/Model_Document.cpp @@ -490,6 +490,11 @@ bool Model_Document::finishOperation() bool isNestedClosed = !myDoc->HasOpenCommand() && !myNestedNum.empty(); static std::shared_ptr aSession = std::static_pointer_cast(Model_Session::get()); + + // open transaction if nested is closed to fit inside all synchronizeBackRefs and flushed consequences + if (isNestedClosed) { + myDoc->OpenCommand(); + } // do it before flashes to enable and recompute nesting features correctly if (myNestedNum.empty() || (isNestedClosed && myNestedNum.size() == 1)) { // if all nested operations are closed, make current the higher level objects (to perform @@ -509,6 +514,12 @@ bool Model_Document::finishOperation() aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); + + if (isNestedClosed) { + if (myDoc->CommitCommand()) + myTransactions.rbegin()->myOCAFNum++; + } + // this must be here just after everything is finished but before real transaction stop // to avoid messages about modifications outside of the transaction // and to rebuild everything after all updates and creates diff --git a/src/Model/Model_Expression.cpp b/src/Model/Model_Expression.cpp index 1cd650101..1624e8d02 100644 --- a/src/Model/Model_Expression.cpp +++ b/src/Model/Model_Expression.cpp @@ -14,6 +14,7 @@ #include #include +#include static Standard_GUID kInvalidGUID("caee5ce4-34b1-4b29-abcb-685287d18096"); @@ -117,7 +118,7 @@ double Model_ExpressionDouble::value() { if (myIsInitialized) return myReal->Get(); - return -1.; // error + return std::numeric_limits::max(); // error } void Model_ExpressionDouble::setInvalid(const bool theFlag) @@ -158,7 +159,7 @@ int Model_ExpressionInteger::value() { if (myIsInitialized) return myInteger->Get(); - return -1; // error + return std::numeric_limits::max(); // error } void Model_ExpressionInteger::setInvalid(const bool theFlag) -- 2.39.2