From 4ebf9cb20e35ebf7f8d6dedcb09d065f589c471e Mon Sep 17 00:00:00 2001 From: Tobias Hunger <tobias.hunger@nokia.com> Date: Thu, 1 Apr 2010 13:07:32 +0200 Subject: [PATCH] Fix possible crash on project import Fix possible crash on import of projects into creator with only one valid Qt version set up. Reviewed-by: dt Task-number: QTCREATORBUG-1017 --- .../qt4projectmanager/projectloadwizard.cpp | 18 +++++++++--------- .../qt4projectmanager/projectloadwizard.h | 2 -- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/plugins/qt4projectmanager/projectloadwizard.cpp b/src/plugins/qt4projectmanager/projectloadwizard.cpp index f82c3203e53..7ba4da6cbc1 100644 --- a/src/plugins/qt4projectmanager/projectloadwizard.cpp +++ b/src/plugins/qt4projectmanager/projectloadwizard.cpp @@ -54,13 +54,7 @@ ProjectLoadWizard::ProjectLoadWizard(Qt4Project *project, QWidget *parent, Qt::W setWindowTitle(tr("Project setup")); - m_importVersions = TargetSetupPage::recursivelyCheckDirectoryForBuild(project->projectDirectory()); - m_importVersions.append(TargetSetupPage::recursivelyCheckDirectoryForBuild(project->defaultTopLevelBuildDirectory())); - - m_importVersions.append(TargetSetupPage::importInfosForKnownQtVersions(project)); - - if (m_importVersions.count() > 1) - setupTargetPage(); + setupTargetPage(); setOptions(options() | QWizard::NoCancelButton | QWizard::NoBackButtonOnLastPage); } @@ -100,11 +94,18 @@ void ProjectLoadWizard::setupTargetPage() if (m_targetSetupPage) return; + QList<TargetSetupPage::ImportInfo> importVersions = TargetSetupPage::recursivelyCheckDirectoryForBuild(m_project->projectDirectory()); + importVersions.append(TargetSetupPage::recursivelyCheckDirectoryForBuild(m_project->defaultTopLevelBuildDirectory())); + importVersions.append(TargetSetupPage::importInfosForKnownQtVersions(m_project)); + m_targetSetupPage = new TargetSetupPage(this); - m_targetSetupPage->setImportInfos(m_importVersions); + m_targetSetupPage->setImportInfos(importVersions); m_targetSetupPage->setImportDirectoryBrowsingEnabled(true); m_targetSetupPage->setImportDirectoryBrowsingLocation(m_project->projectDirectory()); + if (importVersions.count() <= 1) + return; + const int targetPageId = addPage(m_targetSetupPage); wizardProgress()->item(targetPageId)->setTitle(tr("Targets")); } @@ -114,4 +115,3 @@ void ProjectLoadWizard::applySettings() Q_ASSERT(m_targetSetupPage); m_targetSetupPage->setupProject(m_project); } - diff --git a/src/plugins/qt4projectmanager/projectloadwizard.h b/src/plugins/qt4projectmanager/projectloadwizard.h index 12376095ca0..f6bba107c24 100644 --- a/src/plugins/qt4projectmanager/projectloadwizard.h +++ b/src/plugins/qt4projectmanager/projectloadwizard.h @@ -57,8 +57,6 @@ private: void applySettings(); Qt4Project *m_project; - QList<TargetSetupPage::ImportInfo> m_importVersions; - TargetSetupPage *m_targetSetupPage; }; -- GitLab