aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hartmann <Thomas.Hartmann@qt.io>2021-10-05 18:16:27 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2021-10-07 09:22:21 +0000
commitcfc732fe8f5934da3beba50849d1a378c2efbc47 (patch)
tree370ea7b8b87fabc77f8b1f93af4780bd126fe916
parent033d2c5cc34d44aa9fa6c69475e33fc6c00af155 (diff)
QmlDesigner: Remove all references also to children
If a node is deleted also children are deleted. We have to remove all references to children, too. Change-Id: Ie944b00ffc832fb0fb11ef0380c4b9b30add5757 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r--src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp
index c5ad9244a2..25f792e908 100644
--- a/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp
+++ b/src/plugins/qmldesigner/designercore/model/qmlobjectnode.cpp
@@ -368,6 +368,14 @@ static void removeLayerEnabled(const ModelNode &node)
}
}
+static void deleteAllReferencesToNodeAndChildren(const ModelNode &node)
+{
+ BindingProperty::deleteAllReferencesTo(node);
+ const auto subNodes = node.allSubModelNodes();
+ for (const ModelNode &child : subNodes)
+ BindingProperty::deleteAllReferencesTo(child);
+}
+
/*!
Deletes this object's node and its dependencies from the model.
Everything that belongs to this Object, the ModelNode, and ChangeOperations
@@ -406,7 +414,7 @@ void QmlObjectNode::destroy()
}
removeStateOperationsForChildren(modelNode());
- BindingProperty::deleteAllReferencesTo(modelNode());
+ deleteAllReferencesToNodeAndChildren(modelNode());
QmlFlowViewNode root(view()->rootModelNode());