Salome HOME
Issue #3243: Abort active operation in case of Undo as a part of Undo command.
authorvsv <vsv@opencascade.com>
Fri, 15 May 2020 11:44:02 +0000 (14:44 +0300)
committervsv <vsv@opencascade.com>
Fri, 15 May 2020 11:44:02 +0000 (14:44 +0300)
src/XGUI/XGUI_Workshop.cpp

index 42276a0657e5459aaa7b0fa553bfd5c0dbe039d2..04b706b06a665bbd203fbf5b8a855305fa5bf9c4 100644 (file)
@@ -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<std::string> anActionList = theActionType == ActionUndo ? aMgr->undoList()
     : aMgr->redoList();
   std::list<std::string>::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