From def3dd1cf6f4a3815d24ffc473d28e4662df9384 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 18 Aug 2010 15:38:42 +0200 Subject: [PATCH] Make sure newly added RunConfigurations have unique names --- src/plugins/projectexplorer/target.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/target.cpp b/src/plugins/projectexplorer/target.cpp index bcb79aa4423..3d9e41665af 100644 --- a/src/plugins/projectexplorer/target.cpp +++ b/src/plugins/projectexplorer/target.cpp @@ -164,8 +164,8 @@ void Target::addDeployConfiguration(DeployConfiguration *dc) // Check that we don't have a configuration with the same displayName QString configurationDisplayName = dc->displayName(); QStringList displayNames; - foreach (const DeployConfiguration *bc, m_deployConfigurations) - displayNames << bc->displayName(); + foreach (const DeployConfiguration *current, m_deployConfigurations) + displayNames << current->displayName(); configurationDisplayName = Project::makeUnique(configurationDisplayName, displayNames); dc->setDisplayName(configurationDisplayName); @@ -229,6 +229,14 @@ void Target::addRunConfiguration(RunConfiguration* runConfiguration) QTC_ASSERT(runConfiguration && !m_runConfigurations.contains(runConfiguration), return); Q_ASSERT(runConfiguration->target() == this); + // Check that we don't have a configuration with the same displayName + QString configurationDisplayName = runConfiguration->displayName(); + QStringList displayNames; + foreach (const RunConfiguration *rc, m_runConfigurations) + displayNames << rc->displayName(); + configurationDisplayName = Project::makeUnique(configurationDisplayName, displayNames); + runConfiguration->setDisplayName(configurationDisplayName); + m_runConfigurations.push_back(runConfiguration); emit addedRunConfiguration(runConfiguration);