diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index a6e6a4f73..08ba05cfc 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -145,6 +145,7 @@ MainWindow::MainWindow() : connect(mRecentProjectActs[i], SIGNAL(triggered()), this, SLOT(OpenRecentProject())); } + mRecentProjectActs[MaxRecentProjects] = NULL; // The separator mUI.mActionProjectMRU->setVisible(false); UpdateMRUMenuItems(); } @@ -1042,7 +1043,7 @@ void MainWindow::OpenRecentProject() void MainWindow::UpdateMRUMenuItems() { - for (int i = 0; i < MaxRecentProjects; i++) + for (int i = 0; i < MaxRecentProjects + 1; i++) { if (mRecentProjectActs[i] != NULL) mUI.mMenuFile->removeAction(mRecentProjectActs[i]); @@ -1061,7 +1062,7 @@ void MainWindow::UpdateMRUMenuItems() } if (numRecentProjects > 1) - mUI.mMenuFile->insertSeparator(mUI.mActionProjectMRU); + mRecentProjectActs[numRecentProjects] = mUI.mMenuFile->insertSeparator(mUI.mActionProjectMRU); } void MainWindow::AddProjectMRU(const QString &project) diff --git a/gui/mainwindow.h b/gui/mainwindow.h index 9abbdb450..1c9ca2ad3 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -473,9 +473,10 @@ private: bool mExiting; /** - * @brief Project MRU menu actions. - */ - QAction *mRecentProjectActs[MaxRecentProjects]; + * @brief Project MRU menu actions. + * List of MRU menu actions. Needs also to store the separator. + */ + QAction *mRecentProjectActs[MaxRecentProjects + 1]; }; /// @} #endif // MAINWINDOW_H