From 4ac6f2284fe917736f0b30978799a20c3ea775d1 Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 20 May 2015 15:49:53 +0300 Subject: [PATCH] Open transaction before setCurrentFeatuire if it is not opened --- src/ModuleBase/ModuleBase_Operation.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index ba66473b5..50681c8d2 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -191,21 +191,26 @@ void ModuleBase_Operation::abort() bool ModuleBase_Operation::commit() { if (canBeCommitted()) { + SessionPtr aMgr = ModelAPI_Session::get(); /// Set current feature and remeber old current feature if (myIsEditing) { - SessionPtr aMgr = ModelAPI_Session::get(); DocumentPtr aDoc = aMgr->activeDocument(); + bool aIsOp = aMgr->isOperation(); + if (!aIsOp) + aMgr->startOperation(); aDoc->setCurrentFeature(myCurrentFeature, true); + if (!aIsOp) + aMgr->finishOperation(); myCurrentFeature = FeaturePtr(); } commitOperation(); // check whether there are modifications performed during the current operation // in the model // in case if there are no modifications, do not increase the undo/redo stack - if (ModelAPI_Session::get()->isModified()) - ModelAPI_Session::get()->finishOperation(); + if (aMgr->isModified()) + aMgr->finishOperation(); else - ModelAPI_Session::get()->abortOperation(); + aMgr->abortOperation(); stopOperation(); emit stopped(); -- 2.39.2