From: mpv Date: Thu, 6 Jun 2019 08:47:30 +0000 (+0300) Subject: Allow nested transactions have any number of attached transactions (needed for filter... X-Git-Tag: VEDF2019Lot4~101^2~38^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=25bd4b40824c7df4344337256f7a4691e4f219c7;p=modules%2Fshaper.git Allow nested transactions have any number of attached transactions (needed for filters Selection feature restart in Groups any time in new nested transaction). --- diff --git a/src/Model/Model_Session.cpp b/src/Model/Model_Session.cpp index b07ca70d4..5a8f6f736 100644 --- a/src/Model/Model_Session.cpp +++ b/src/Model/Model_Session.cpp @@ -80,7 +80,7 @@ void Model_Session::closeAll() void Model_Session::startOperation(const std::string& theId, const bool theAttachedToNested) { - myOperationAttachedToNext = theAttachedToNested; + myOperationAttachedToNext.push_back(theAttachedToNested); ROOT_DOC->startOperation(); ROOT_DOC->operationId(theId); static std::shared_ptr aStartedMsg @@ -98,10 +98,11 @@ void Model_Session::finishOperation() { setCheckTransactions(false); ROOT_DOC->finishOperation(); - if (myOperationAttachedToNext) { // twice, with nested + while(myOperationAttachedToNext.back()) { // with nested, the first transaction can not be attached ROOT_DOC->finishOperation(); - myOperationAttachedToNext = false; + myOperationAttachedToNext.pop_back(); } + myOperationAttachedToNext.pop_back(); setCheckTransactions(true); } @@ -109,10 +110,11 @@ void Model_Session::abortOperation() { setCheckTransactions(false); ROOT_DOC->abortOperation(); - if (myOperationAttachedToNext) { // twice, with nested + while(myOperationAttachedToNext.back()) { // with nested, the first transaction can not be attached ROOT_DOC->abortOperation(); - myOperationAttachedToNext = false; + myOperationAttachedToNext.pop_back(); } + myOperationAttachedToNext.pop_back(); setCheckTransactions(true); // here the update mechanism may work after abort, so, suppress the warnings about // modifications outside of the transactions @@ -427,7 +429,6 @@ Model_Session::Model_Session() { myPluginsInfoLoaded = false; myCheckTransactions = true; - myOperationAttachedToNext = false; ModelAPI_Session::setSession(std::shared_ptr(this)); // register the configuration reading listener Events_Loop* aLoop = Events_Loop::loop(); diff --git a/src/Model/Model_Session.h b/src/Model/Model_Session.h index 9b3da71a8..c54d89229 100644 --- a/src/Model/Model_Session.h +++ b/src/Model/Model_Session.h @@ -48,7 +48,8 @@ class Model_Session : public ModelAPI_Session, public Events_Listener /// if true, generates error if document is updated outside of transaction bool myCheckTransactions; - bool myOperationAttachedToNext; ///< the current operation must be committed twice, with nested + ///< if true, the current operation must be committed twice, with nested (list for any nesting depth) + std::list myOperationAttachedToNext; public: //! Loads the OCAF document from the file.