forked from qt-creator/qt-creator
Fix crash in QmlDesigner navigator
Happened when trying to reparent a node to one of it's children.
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user