Commit a6bba8ca authored by Christian Kandeler's avatar Christian Kandeler

QbsProjectManager: Fix crash when an install step is removed.

The object has already been deleted when the stepRemoved() signal comes
in, so we call disconnect() on a dangling pointer.

Change-Id: Ife5192f9edbde3d42c96dbcae60d7eb03b051745
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent b382690d
......@@ -192,6 +192,8 @@ void QbsRunConfiguration::installStepChanged()
if (m_currentBuildStepList) {
connect(m_currentBuildStepList, SIGNAL(stepInserted(int)), this, SLOT(installStepChanged()));
connect(m_currentBuildStepList, SIGNAL(aboutToRemoveStep(int)), this,
SLOT(installStepToBeRemoved(int)));
connect(m_currentBuildStepList, SIGNAL(stepRemoved(int)), this, SLOT(installStepChanged()));
connect(m_currentBuildStepList, SIGNAL(stepMoved(int,int)), this, SLOT(installStepChanged()));
}
......@@ -199,6 +201,17 @@ void QbsRunConfiguration::installStepChanged()
emit targetInformationChanged();
}
void QbsRunConfiguration::installStepToBeRemoved(int pos)
{
QTC_ASSERT(m_currentBuildStepList, return);
// TODO: Our logic is rather broken. Users can create as many qbs install steps as they want,
// but we ignore all but the first one.
if (m_currentBuildStepList->steps().at(pos) != m_currentInstallStep)
return;
disconnect(m_currentInstallStep, SIGNAL(changed()), this, SIGNAL(targetInformationChanged()));
m_currentInstallStep = 0;
}
QString QbsRunConfiguration::executable() const
{
QbsProject *pro = static_cast<QbsProject *>(target()->project());
......
......@@ -105,6 +105,7 @@ protected:
private slots:
void installStepChanged();
void installStepToBeRemoved(int pos);
private:
void setBaseWorkingDirectory(const QString &workingDirectory);
......
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