From 0ab4ad6f7878fd9884e435bba604f229c4eb27d1 Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 23 Jun 2015 17:25:19 +0300 Subject: [PATCH] Avoid hung-up on exit of SALOME when NewGeom is non active --- src/NewGeom/NewGeom_Module.cpp | 7 +++++-- src/XGUI/XGUI_Workshop.cpp | 8 ++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/NewGeom/NewGeom_Module.cpp b/src/NewGeom/NewGeom_Module.cpp index f5927a5ef..547ed1ab5 100644 --- a/src/NewGeom/NewGeom_Module.cpp +++ b/src/NewGeom/NewGeom_Module.cpp @@ -443,8 +443,11 @@ void NewGeom_Module::addDesktopMenuSeparator(const char* theMenuSourceText, cons QList NewGeom_Module::commandList() const { QList aActions; - for (int i = 0; i < myActionsList.size(); i++) - aActions.append(action(i)); + for (int i = 0; i < myActionsList.size(); i++) { + QAction* aCmd = action(i); + if (aCmd && myActionsList.contains(aCmd->data().toString())) + aActions.append(aCmd); + } return aActions; } diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index ec7ddf45a..1b8d586e0 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1118,20 +1118,16 @@ void XGUI_Workshop::updateCommandStatus() } SessionPtr aMgr = ModelAPI_Session::get(); if (aMgr->hasModuleDocument()) { - QAction *aUndoCmd, *aRedoCmd; foreach(QAction* aCmd, aCommands) { QString aId = aCmd->data().toString(); if (aId == "UNDO_CMD") - aUndoCmd = aCmd; + aCmd->setEnabled(myModule->canUndo()); else if (aId == "REDO_CMD") - aRedoCmd = aCmd; + aCmd->setEnabled(myModule->canRedo()); else // Enable all commands aCmd->setEnabled(true); } - - aUndoCmd->setEnabled(myModule->canUndo()); - aRedoCmd->setEnabled(myModule->canRedo()); updateHistory(); } else { foreach(QAction* aCmd, aCommands) { -- 2.39.2