From 362c5f604c9a018663c545c3972583b2d1560b81 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Tue, 10 Jan 2012 21:16:47 +0200 Subject: [PATCH] GUI: Fix crash opening project file from command line. The GUI crashed if the project file was tried to open from the command line. The project file loading was run before the MRU menu was created but tried to add a new item to it. --- gui/mainwindow.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index c4d8a9e14..209e6b7ad 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -134,13 +134,8 @@ MainWindow::MainWindow() : EnableProjectOpenActions(true); EnableProjectActions(false); - QStringList args = QCoreApplication::arguments(); - //Remove the application itself - args.removeFirst(); - if (!args.isEmpty()) { - HandleCLIParams(args); - } - + // Must setup MRU menu before CLI param handling as it can load a + // project file and update MRU menu. for (int i = 0; i < MaxRecentProjects; ++i) { mRecentProjectActs[i] = new QAction(this); mRecentProjectActs[i]->setVisible(false); @@ -151,6 +146,13 @@ MainWindow::MainWindow() : mUI.mActionProjectMRU->setVisible(false); UpdateMRUMenuItems(); + QStringList args = QCoreApplication::arguments(); + //Remove the application itself + args.removeFirst(); + if (!args.isEmpty()) { + HandleCLIParams(args); + } + for (int i = 0; i < mPlatforms.getCount(); i++) { Platform plat = mPlatforms.mPlatforms[i]; QAction *act = new QAction(this);