From 3061d7dc320711c7eea76b29c0da48ea87409b19 Mon Sep 17 00:00:00 2001
From: Tobias Hunger <tobias.hunger@nokia.com>
Date: Fri, 15 Jan 2010 10:54:29 +0100
Subject: [PATCH] Check (build|run)configurations on addition

 * Make sure we do not add duplicate or 0 (build|run)configurations
   to a project.

Reviewed-by: dt
---
 src/plugins/projectexplorer/project.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp
index 374da674f44..9f82808b422 100644
--- a/src/plugins/projectexplorer/project.cpp
+++ b/src/plugins/projectexplorer/project.cpp
@@ -83,6 +83,8 @@ QString Project::makeUnique(const QString &preferredName, const QStringList &use
 
 void Project::addBuildConfiguration(BuildConfiguration *configuration)
 {
+    QTC_ASSERT(!configuration || m_buildConfigurations.contains(configuration), return);
+
     // Check that we don't have a configuration with the same displayName
     QString configurationDisplayName = configuration->displayName();
     QStringList displayNames;
@@ -413,10 +415,8 @@ QList<RunConfiguration *> Project::runConfigurations() const
 
 void Project::addRunConfiguration(RunConfiguration* runConfiguration)
 {
-    if (m_runConfigurations.contains(runConfiguration)) {
-        qWarning()<<"Not adding already existing runConfiguration"<<runConfiguration->displayName();
-        return;
-    }
+    QTC_ASSERT(!runConfiguration || m_runConfigurations.contains(runConfiguration), return);
+
     m_runConfigurations.push_back(runConfiguration);
     emit addedRunConfiguration(this, runConfiguration->displayName());
 }
-- 
GitLab