From f9886a14f3df64d0ab529cef91bdd3dee8131a47 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 15 May 2020 14:44:02 +0300 Subject: [PATCH] Issue #3243: Abort active operation in case of Undo as a part of Undo command. --- src/XGUI/XGUI_Workshop.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 42276a065..04b706b06 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1225,14 +1225,17 @@ void XGUI_Workshop::processUndoRedo(const ModuleBase_ActionType theActionType, i // until redo of all possible objects happens bool isUpdateEnabled = myDisplayer->enableUpdateViewer(false); + int aTimes = theTimes; SessionPtr aMgr = ModelAPI_Session::get(); if (aMgr->isOperation()) { XGUI_OperationMgr* aOpMgr = operationMgr(); /// this is important for nested operations /// when sketch operation is active, this condition is false and /// the sketch operation is not aborted - if (aOpMgr->canStopOperation(aOpMgr->currentOperation())) + if (aOpMgr->canStopOperation(aOpMgr->currentOperation())) { aOpMgr->abortOperation(aOpMgr->currentOperation()); + aTimes--; + } else { myDisplayer->enableUpdateViewer(isUpdateEnabled); @@ -1243,7 +1246,7 @@ void XGUI_Workshop::processUndoRedo(const ModuleBase_ActionType theActionType, i std::list anActionList = theActionType == ActionUndo ? aMgr->undoList() : aMgr->redoList(); std::list::const_iterator aIt = anActionList.cbegin(); - for (int i = 0; (i < theTimes) && (aIt != anActionList.cend()); ++i, ++aIt) { + for (int i = 0; (i < aTimes) && (aIt != anActionList.cend()); ++i, ++aIt) { if (theActionType == ActionUndo) aMgr->undo(); else -- 2.39.2