From c4a8272734f9be32247434c1384daa2c3baf6f9a Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Wed, 9 Apr 2025 13:54:57 +0200 Subject: [PATCH] QmlDesigner: Fix crash The items in selection tool can be dangling. Therefore we check it against all items in the scene. Task-number: QDS-15146 Change-Id: I1008e6855f874bf4f9d6c2f615ecf6b628747666 Reviewed-by: Tim Jenssen --- .../qmldesigner/components/formeditor/selectiontool.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp b/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp index d30539d52b6..13a26252877 100644 --- a/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp +++ b/src/plugins/qmldesigner/components/formeditor/selectiontool.cpp @@ -223,9 +223,12 @@ void SelectionTool::itemsAboutToRemoved(const QList &itemList) { const QList current = items(); - QList remaining = Utils::filtered(current, [&itemList](FormEditorItem *item) { - return !itemList.contains(item); - }); + const auto allItems = scene()->items(); + QList remaining = Utils::filtered(current, + [&itemList, &allItems](FormEditorItem *item) { + return !itemList.contains(item) + && allItems.contains(item); + }); if (!remaining.isEmpty()) { m_selectionIndicator.setItems(remaining);