From c2f9d8a99db280941237b7ed35052547d55bd014 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 25 Sep 2017 15:22:28 +0200 Subject: ObjectModel: provide unique move IDs QQuickItemViewPrivate::removeItem() uses a QHash to store items that were removed due to a move. If the move IDs are not unique, multiple buffered moves end up overriding each other. This results to leaked items that are never released. Task-number: QTBUG-62607 Change-Id: I7e7e7fcd6b1b0aa50ed55643ba5674e98536f89f Reviewed-by: Mitch Curtis Reviewed-by: Michael Brasser --- src/qml/types/qqmlobjectmodel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/qml/types') diff --git a/src/qml/types/qqmlobjectmodel.cpp b/src/qml/types/qqmlobjectmodel.cpp index 64d0169f6b..dcd0360199 100644 --- a/src/qml/types/qqmlobjectmodel.cpp +++ b/src/qml/types/qqmlobjectmodel.cpp @@ -72,7 +72,7 @@ public: int ref; }; - QQmlObjectModelPrivate() : QObjectPrivate() {} + QQmlObjectModelPrivate() : QObjectPrivate(), moveId(0) {} static void children_append(QQmlListProperty *prop, QObject *item) { int index = static_cast(prop->data)->children.count(); @@ -129,7 +129,7 @@ public: } QQmlChangeSet changeSet; - changeSet.move(from, to, n, 0); + changeSet.move(from, to, n, ++moveId); emit q->modelUpdated(changeSet, false); emit q->childrenChanged(); } @@ -166,7 +166,7 @@ public: return -1; } - + uint moveId; QList children; }; -- cgit v1.2.3