Commit 9548e7ad authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Kit: Fix possible crash



Fix crash in KitOptionsPage related to setting the default kit

Task-number: QTCREATORBUG-14053
Change-Id: Icf10b2596afa0a3b871aca0685a6f7d3a59ab022
Reviewed-by: default avatarDaniel Teske <daniel.teske@theqtcompany.com>
parent a064280c
...@@ -246,6 +246,9 @@ void KitModel::markForRemoval(Kit *k) ...@@ -246,6 +246,9 @@ void KitModel::markForRemoval(Kit *k)
setDefaultNode(static_cast<KitNode *>(newDefault)); setDefaultNode(static_cast<KitNode *>(newDefault));
} }
if (node == m_defaultNode)
setDefaultNode(findItemAtLevel<KitNode *>(2, [node](KitNode *kn) { return kn != node; }));
removeItem(node); removeItem(node);
if (node->widget->configures(0)) if (node->widget->configures(0))
delete node; delete node;
...@@ -353,8 +356,9 @@ void KitModel::removeKit(Kit *k) ...@@ -353,8 +356,9 @@ void KitModel::removeKit(Kit *k)
} }
} }
if (m_defaultNode == node) if (node == m_defaultNode)
m_defaultNode = 0; setDefaultNode(findItemAtLevel<KitNode *>(2, [node](KitNode *kn) { return kn != node; }));
removeItem(node); removeItem(node);
delete node; delete node;
......
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