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.
This commit is contained in:
Kimmo Varis 2012-01-10 21:16:47 +02:00
parent 42b7a4fadd
commit 362c5f604c
1 changed files with 9 additions and 7 deletions

View File

@ -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);