From dc3ec71ab0810224962052e7288cdb026b1abf71 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 7 Apr 2011 15:45:26 +0200 Subject: [PATCH] Maemo: Fix race condition when removing a deploy step. --- .../qt-maemo/maemodeploystepwidget.cpp | 10 ++++++++++ .../qt-maemo/maemodeploystepwidget.h | 1 + .../qt-maemo/maemoinstalltosysrootstep.cpp | 13 +++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp index 82adfa80ff8..b4f0a834923 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp @@ -63,6 +63,8 @@ MaemoDeployStepWidget::MaemoDeployStepWidget(AbstractMaemoDeployStep *step) : connect(list, SIGNAL(stepInserted(int)), SIGNAL(updateSummary())); connect(list, SIGNAL(stepMoved(int,int)), SIGNAL(updateSummary())); connect(list, SIGNAL(stepRemoved(int)), SIGNAL(updateSummary())); + connect(list, SIGNAL(aboutToRemoveStep(int)), + SLOT(handleStepToBeRemoved(int))); } MaemoDeployStepWidget::~MaemoDeployStepWidget() @@ -92,6 +94,14 @@ void MaemoDeployStepWidget::handleDeviceUpdate() emit updateSummary(); } +void MaemoDeployStepWidget::handleStepToBeRemoved(int step) +{ + ProjectExplorer::BuildStepList * const list + = qobject_cast(m_step->parent()); + if (list->steps().at(step) == m_step) + disconnect(list, 0, this, 0); +} + QString MaemoDeployStepWidget::summaryText() const { QString error; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h index 2d03fef4e46..40a17ca0f5a 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.h @@ -58,6 +58,7 @@ private: Q_SLOT void handleDeviceUpdate(); Q_SLOT void setCurrentDeviceConfig(int index); Q_SLOT void showDeviceConfigurations(); + Q_SLOT void handleStepToBeRemoved(int step); virtual void init(); virtual QString summaryText() const; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoinstalltosysrootstep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoinstalltosysrootstep.cpp index 6a9831222ec..28aa234c563 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoinstalltosysrootstep.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoinstalltosysrootstep.cpp @@ -58,10 +58,11 @@ public: virtual void init() { - ProjectExplorer::BuildStepList * const list - = qobject_cast(m_step->parent()); + BuildStepList * const list + = qobject_cast(m_step->parent()); connect(list, SIGNAL(stepInserted(int)), SIGNAL(updateSummary())); connect(list, SIGNAL(stepMoved(int,int)), SIGNAL(updateSummary())); + connect(list, SIGNAL(aboutToRemoveStep(int)), SLOT(handleStepToBeRemoved(int))); connect(list, SIGNAL(stepRemoved(int)), SIGNAL(updateSummary())); } @@ -76,6 +77,14 @@ public: } private: + Q_SLOT void handleStepToBeRemoved(int step) + { + BuildStepList * const list + = qobject_cast(m_step->parent()); + if (list->steps().at(step) == m_step) + disconnect(list, 0, this, 0); + } + const AbstractMaemoInstallPackageToSysrootStep * const m_step; };