diff options
author | Tobias Hunger <tobias.hunger@nokia.com> | 2010-03-30 13:23:11 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@nokia.com> | 2010-03-30 13:26:15 +0200 |
commit | 5398651c93b5054ca1895a4c2c7fbc70bbcf6913 (patch) | |
tree | 9316ecbdb08296a3e2ef05b4cd1bc277640c7cc7 /src/plugins/projectexplorer | |
parent | 7c3caca03cb795985ab97bfae14d87da63c253a5 (diff) |
Make targetsettingspanel more robust
Kudos to dt for spotting this
Diffstat (limited to 'src/plugins/projectexplorer')
-rw-r--r-- | src/plugins/projectexplorer/targetsettingspanel.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index be6d51122c..88e84c670a 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -136,6 +136,16 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd if (subIndex < -1 || subIndex >= 2) return; + if (targetIndex == -1 || subIndex == -1) { // no more targets! + delete m_panelWidgets[0]; + m_panelWidgets[0] = 0; + delete m_panelWidgets[1]; + m_panelWidgets[1] = 0; + + m_centralWidget->setCurrentWidget(m_noTargetLabel); + return; + } + Target *target = m_targets.at(targetIndex); // Target was not actually changed: @@ -147,13 +157,8 @@ void TargetSettingsPanelWidget::currentTargetChanged(int targetIndex, int subInd return; } - m_currentTarget = target; - // Target has changed: - if (targetIndex == -1) { // no more targets! - m_centralWidget->setCurrentWidget(m_noTargetLabel); - return; - } + m_currentTarget = target; PanelsWidget *buildPanel = new PanelsWidget(m_centralWidget); PanelsWidget *runPanel = new PanelsWidget(m_centralWidget); |