From c103885635f6138ecc4e0ac95aa04b22bafb481f Mon Sep 17 00:00:00 2001
From: Daniel Teske <daniel.teske@theqtcompany.com>
Date: Mon, 19 Jan 2015 17:18:28 +0100
Subject: [PATCH] KitModel: Fix crash on removing kits introduced in 7fd21d22a

Removing a kit removes the item from the TreeModel and puts it into
KitModel::m_toRemoveList. A later update to that kit would trigger
the lambda connected to the dirty signal, thus calling node->update(),
which eventually ends up calling node->parent()->m_children, and
node->parent() is a null pointer there.

Change-Id: I9006f1eea036ae99b48a47baa2bc2a33bdcb84b1
Reviewed-by: hjk <hjk@theqtcompany.com>
---
 src/plugins/projectexplorer/kitmodel.cpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/plugins/projectexplorer/kitmodel.cpp b/src/plugins/projectexplorer/kitmodel.cpp
index eeededc5e46..b65fbba9771 100644
--- a/src/plugins/projectexplorer/kitmodel.cpp
+++ b/src/plugins/projectexplorer/kitmodel.cpp
@@ -259,8 +259,10 @@ KitNode *KitModel::createNode(Kit *k)
 {
     KitNode *node = new KitNode(k);
     m_parentLayout->addWidget(node->widget);
-    connect(node->widget, &KitManagerConfigWidget::dirty, [node] {
-        node->update();
+    connect(node->widget, &KitManagerConfigWidget::dirty, [this, node] {
+        if (m_autoRoot->children().contains(node)
+                || m_manualRoot->children().contains(node))
+            node->update();
     });
     return node;
 }
-- 
GitLab