Commit 1e0561e8 authored by dt's avatar dt

Crash on removing RunConfigurations by editing the pro file

Task: 250759
parent e39d006f
......@@ -453,6 +453,7 @@ void Project::addRunConfiguration(QSharedPointer<RunConfiguration> runConfigurat
return;
}
m_runConfigurations.push_back(runConfiguration);
emit addedRunConfiguration(runConfiguration->name());
}
void Project::removeRunConfiguration(QSharedPointer<RunConfiguration> runConfiguration)
......@@ -460,14 +461,19 @@ void Project::removeRunConfiguration(QSharedPointer<RunConfiguration> runConfigu
if(!m_runConfigurations.contains(runConfiguration)) {
qWarning()<<"Not removing runConfiguration"<<runConfiguration->name()<<"becasue it doesn't exist";
return;
}
m_runConfigurations.removeOne(runConfiguration);
}
if (m_activeRunConfiguration == runConfiguration) {
if (m_runConfigurations.isEmpty())
if (m_runConfigurations.size() <= 1)
setActiveRunConfiguration(QSharedPointer<RunConfiguration>(0));
else if (m_runConfigurations.at(0) == m_activeRunConfiguration)
setActiveRunConfiguration(m_runConfigurations.at(1));
else
setActiveRunConfiguration(m_runConfigurations.at(0));
}
m_runConfigurations.removeOne(runConfiguration);
emit removedRunConfiguration(runConfiguration->name());
}
QSharedPointer<RunConfiguration> Project::activeRunConfiguration() const
......
......@@ -140,6 +140,8 @@ signals:
void fileListChanged();
void activeBuildConfigurationChanged();
void activeRunConfigurationChanged();
void removedRunConfiguration(const QString &name);
void addedRunConfiguration(const QString &name);
// This signal is jut there for updating the tree list in the buildsettings wizard
void buildConfigurationDisplayNameChanged(const QString &buildConfiguraiton);
......
......@@ -189,6 +189,15 @@ RunSettingsWidget::RunSettingsWidget(Project *project)
connect(m_ui->removeToolButton, SIGNAL(clicked(bool)),
this, SLOT(removeRunConfiguration()));
connect(m_project, SIGNAL(removedRunConfiguration(QString)),
this, SLOT(initRunConfigurationComboBox()));
connect(m_project, SIGNAL(addedRunConfiguration(QString)),
this, SLOT(initRunConfigurationComboBox()));
connect(m_project, SIGNAL(activeRunConfigurationChanged()),
this, SLOT(activeRunConfigurationChanged()));
initRunConfigurationComboBox();
const QList<QSharedPointer<RunConfiguration> > runConfigurations = m_project->runConfigurations();
for (int i=0; i<runConfigurations.size(); ++i) {
......@@ -285,6 +294,14 @@ void RunSettingsWidget::activateRunConfiguration(int index)
m_ui->groupBox->layout()->addWidget(m_runConfigurationWidget);
}
void RunSettingsWidget::activeRunConfigurationChanged()
{
QSharedPointer<RunConfiguration> active = m_project->activeRunConfiguration();
delete m_runConfigurationWidget;
m_runConfigurationWidget = active->configurationWidget();
m_ui->groupBox->layout()->addWidget(m_runConfigurationWidget);
}
void RunSettingsWidget::nameChanged()
{
RunConfiguration *rc = qobject_cast<RunConfiguration *>(sender());
......
......@@ -77,9 +77,9 @@ private slots:
void addRunConfiguration();
void removeRunConfiguration();
void nameChanged();
private:
void initRunConfigurationComboBox();
void activeRunConfigurationChanged();
private:
Project *m_project;
RunConfigurationsModel *m_runConfigurationsModel;
Ui::RunSettingsPropertiesPage *m_ui;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment