From: vsv Date: Tue, 23 Jun 2015 14:25:19 +0000 (+0300) Subject: Avoid hung-up on exit of SALOME when NewGeom is non active X-Git-Tag: V_1.3.0~208 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0ab4ad6f7878fd9884e435bba604f229c4eb27d1;p=modules%2Fshaper.git Avoid hung-up on exit of SALOME when NewGeom is non active --- 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) {