forked from qt-creator/qt-creator
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: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
@@ -192,6 +192,8 @@ void QbsRunConfiguration::installStepChanged()
|
|||||||
|
|
||||||
if (m_currentBuildStepList) {
|
if (m_currentBuildStepList) {
|
||||||
connect(m_currentBuildStepList, SIGNAL(stepInserted(int)), this, SLOT(installStepChanged()));
|
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(stepRemoved(int)), this, SLOT(installStepChanged()));
|
||||||
connect(m_currentBuildStepList, SIGNAL(stepMoved(int,int)), this, SLOT(installStepChanged()));
|
connect(m_currentBuildStepList, SIGNAL(stepMoved(int,int)), this, SLOT(installStepChanged()));
|
||||||
}
|
}
|
||||||
@@ -199,6 +201,17 @@ void QbsRunConfiguration::installStepChanged()
|
|||||||
emit targetInformationChanged();
|
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
|
QString QbsRunConfiguration::executable() const
|
||||||
{
|
{
|
||||||
QbsProject *pro = static_cast<QbsProject *>(target()->project());
|
QbsProject *pro = static_cast<QbsProject *>(target()->project());
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ protected:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void installStepChanged();
|
void installStepChanged();
|
||||||
|
void installStepToBeRemoved(int pos);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setBaseWorkingDirectory(const QString &workingDirectory);
|
void setBaseWorkingDirectory(const QString &workingDirectory);
|
||||||
|
|||||||
Reference in New Issue
Block a user