From d3cccf2db8c46ba3fddba9aebd1a86ca589812b4 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 12 Jan 2010 15:20:11 +0100 Subject: [PATCH] Fix crash in QmlDesigner navigator Happened when trying to reparent a node to one of it's children. --- .../components/navigator/navigatortreemodel.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp index 87c18f4e035..c3af8b193c0 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatortreemodel.cpp @@ -138,8 +138,7 @@ bool NavigatorTreeModel::dropMimeData(const QMimeData *data, QByteArray encodedData = data->data("application/vnd.modelnode.list"); QDataStream stream(&encodedData, QIODevice::ReadOnly); - uint nodeHash = parentIdIndex.data(Qt::UserRole).toUInt(); - QmlItemNode parentItemNode(nodeForHash(nodeHash)); + QmlItemNode parentItemNode(nodeForIndex(parentIdIndex)); QList nodeList; @@ -147,8 +146,8 @@ bool NavigatorTreeModel::dropMimeData(const QMimeData *data, uint nodeHash; stream >> nodeHash; ModelNode node(nodeForHash(nodeHash)); - if (!node.isValid() || node.isAncestorOf(parentItemNode)) - return false; + if (!node.isValid() || (parentItemNode == node) || node.isAncestorOf(parentItemNode)) + continue; nodeList.append(node); }