diff --git a/src/plugins/projectexplorer/profilemodel.cpp b/src/plugins/projectexplorer/profilemodel.cpp index 9802d4b5553..8c34f04cfee 100644 --- a/src/plugins/projectexplorer/profilemodel.cpp +++ b/src/plugins/projectexplorer/profilemodel.cpp @@ -364,6 +364,15 @@ void ProfileModel::markForRemoval(Profile *p) if (!node) return; + if (node == m_defaultNode) { + ProfileNode *newDefault = 0; + if (!m_autoRoot->childNodes.isEmpty()) + newDefault = m_autoRoot->childNodes.at(0); + else if (!m_manualRoot->childNodes.isEmpty()) + newDefault = m_manualRoot->childNodes.at(0); + setDefaultNode(newDefault); + } + beginRemoveRows(index(m_manualRoot), m_manualRoot->childNodes.indexOf(node), m_manualRoot->childNodes.indexOf(node)); m_manualRoot->childNodes.removeOne(node); node->parent = 0; @@ -376,15 +385,6 @@ void ProfileModel::markForRemoval(Profile *p) m_toRemoveList.append(node); } endRemoveRows(); - - if (node == m_defaultNode) { - ProfileNode *newDefault = 0; - if (!m_autoRoot->childNodes.isEmpty()) - newDefault = m_autoRoot->childNodes.at(0); - else if (!m_manualRoot->childNodes.isEmpty()) - newDefault = m_manualRoot->childNodes.at(0); - setDefaultNode(newDefault); - } } void ProfileModel::markForAddition(Profile *p)