Fix crash in QmlDesigner navigator

Happened when trying to reparent a node to one of it's children.
This commit is contained in:
Kai Koehne
2010-01-12 15:20:11 +01:00
parent 85ab6eee45
commit d3cccf2db8

View File

@@ -138,8 +138,7 @@ bool NavigatorTreeModel::dropMimeData(const QMimeData *data,
QByteArray encodedData = data->data("application/vnd.modelnode.list"); QByteArray encodedData = data->data("application/vnd.modelnode.list");
QDataStream stream(&encodedData, QIODevice::ReadOnly); QDataStream stream(&encodedData, QIODevice::ReadOnly);
uint nodeHash = parentIdIndex.data(Qt::UserRole).toUInt(); QmlItemNode parentItemNode(nodeForIndex(parentIdIndex));
QmlItemNode parentItemNode(nodeForHash(nodeHash));
QList<ModelNode> nodeList; QList<ModelNode> nodeList;
@@ -147,8 +146,8 @@ bool NavigatorTreeModel::dropMimeData(const QMimeData *data,
uint nodeHash; uint nodeHash;
stream >> nodeHash; stream >> nodeHash;
ModelNode node(nodeForHash(nodeHash)); ModelNode node(nodeForHash(nodeHash));
if (!node.isValid() || node.isAncestorOf(parentItemNode)) if (!node.isValid() || (parentItemNode == node) || node.isAncestorOf(parentItemNode))
return false; continue;
nodeList.append(node); nodeList.append(node);
} }