From: vsv Date: Wed, 20 May 2015 12:49:53 +0000 (+0300) Subject: Open transaction before setCurrentFeatuire if it is not opened X-Git-Tag: V_1.2.0~138 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4ac6f2284fe917736f0b30978799a20c3ea775d1;p=modules%2Fshaper.git Open transaction before setCurrentFeatuire if it is not opened --- 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();