Start: Add command Start_Start only once
This fixes an error message that the command is duplicated. And it fixes a memory leak
This commit is contained in:
@@ -69,8 +69,11 @@ void CmdStart::activated(int iMsg)
|
||||
void StartGui::Manipulator::modifyMenuBar(Gui::MenuItem* menuBar)
|
||||
{
|
||||
Gui::CommandManager& rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
auto newCommand = gsl::owner<CmdStart*>(new CmdStart);
|
||||
rcCmdMgr.addCommand(newCommand); // Transfer ownership
|
||||
if (!rcCmdMgr.getCommandByName("Start_Start")) {
|
||||
auto newCommand = gsl::owner<CmdStart*>(new CmdStart);
|
||||
rcCmdMgr.addCommand(newCommand); // Transfer ownership
|
||||
}
|
||||
|
||||
Gui::MenuItem* helpMenu = menuBar->findItem("&Help");
|
||||
Gui::MenuItem* loadStart = new Gui::MenuItem();
|
||||
loadStart->setCommand("Start_Start");
|
||||
|
||||
Reference in New Issue
Block a user