diff options
author | Christian Kandeler <christian.kandeler@digia.com> | 2014-07-10 17:01:54 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@digia.com> | 2014-07-11 11:33:58 +0200 |
commit | 853497fb4b4c140cd05f529aac23a3b0fadbc02c (patch) | |
tree | 5db1e90f323ac9299abaa7708199551d8cb4a834 /src/plugins/qbsprojectmanager/qbsproject.cpp | |
parent | 5e8bd53a791c7aca04dcc243fccf5e568640a45d (diff) | |
download | qt-creator-853497fb4b4c140cd05f529aac23a3b0fadbc02c.tar.gz |
QbsProjectManager: Sanitize QbsProjectNode.
The current code keeps an instance of QbsProject and of qbs::Project in
every project node, with them being null/invalid everywhere except for
the top-level node. Instead, introduce a dedicated class for the root
node and hold a QbsProject only there. The qbs::Project is held in
QbsProject now.
As a nice side effect, this also fixes QBS-644, presumably because the
dubious-looking use of projectNode() has been removed.
Task-number: QBS-644
Change-Id: I5d36806745b9d67879db6f48aa56bc97868e4f17
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'src/plugins/qbsprojectmanager/qbsproject.cpp')
-rw-r--r-- | src/plugins/qbsprojectmanager/qbsproject.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/src/plugins/qbsprojectmanager/qbsproject.cpp b/src/plugins/qbsprojectmanager/qbsproject.cpp index c0d69a8c1b..18861fd4c5 100644 --- a/src/plugins/qbsprojectmanager/qbsproject.cpp +++ b/src/plugins/qbsprojectmanager/qbsproject.cpp @@ -120,7 +120,7 @@ QbsProject::QbsProject(QbsManager *manager, const QString &fileName) : updateDocuments(QSet<QString>() << fileName); // NOTE: QbsProjectNode does not use this as a parent! - m_rootProjectNode = new QbsProjectNode(this); // needs documents to be initialized! + m_rootProjectNode = new QbsRootProjectNode(this); // needs documents to be initialized! } QbsProject::~QbsProject() @@ -255,16 +255,14 @@ Utils::FileName QbsProject::defaultBuildDirectory(const QString &projectFilePath qbs::Project QbsProject::qbsProject() const { - if (!m_rootProjectNode) - return qbs::Project(); - return m_rootProjectNode->qbsProject(); + return m_qbsProject; } const qbs::ProjectData QbsProject::qbsProjectData() const { - if (!m_rootProjectNode) - return qbs::ProjectData(); - return m_rootProjectNode->qbsProjectData(); + if (m_qbsProject.isValid()) + return m_qbsProject.projectData(); + return qbs::ProjectData(); } bool QbsProject::needsSpecialDeployment() const @@ -276,12 +274,14 @@ void QbsProject::handleQbsParsingDone(bool success) { QTC_ASSERT(m_qbsProjectParser, return); - qbs::Project project; - if (success) - project = m_qbsProjectParser->qbsProject(); - generateErrors(m_qbsProjectParser->error()); + if (success) { + m_qbsProject = m_qbsProjectParser->qbsProject(); + QTC_CHECK(m_qbsProject.isValid()); + readQbsData(); + } + m_qbsProjectParser->deleteLater(); m_qbsProjectParser = 0; @@ -291,11 +291,6 @@ void QbsProject::handleQbsParsingDone(bool success) m_qbsUpdateFutureInterface = 0; } - if (project.isValid()) - m_rootProjectNode->setProject(project); - - readQbsData(); - emit projectParsingDone(success); } |