#2856 Context menus. Fix logical error during menu build-up

This commit is contained in:
Bjørn Erik Jensen
2018-05-07 11:03:52 +02:00
parent 2aeafb509b
commit d659b8e853

View File

@@ -202,13 +202,18 @@ void CmdFeatureMenuBuilder::appendToMenu(QMenu* menu)
CAF_ASSERT(act); CAF_ASSERT(act);
bool duplicateAct = false;
for (QAction* existingAct : currentMenu->actions()) for (QAction* existingAct : currentMenu->actions())
{ {
// If action exist, continue to make sure the action is positioned at the first // If action exist, continue to make sure the action is positioned at the first
// location of a command ID // location of a command ID
if (existingAct == act) if (existingAct == act)
continue; {
duplicateAct = true;
break;
} }
}
if (duplicateAct) continue;
currentMenu->addAction(const_cast<QAction*>(act)); currentMenu->addAction(const_cast<QAction*>(act));
} }