diff options
author | Mitch Curtis <[email protected]> | 2021-11-04 10:41:28 +0100 |
---|---|---|
committer | Mitch Curtis <[email protected]> | 2021-11-26 21:23:08 +0100 |
commit | 5d656b31eb371c9e0bb97c558f9193b08471f1d7 (patch) | |
tree | 0349bce0741278e3436454aea82dab5507947ef7 | |
parent | 716aa788188dc48aed0a24ed012976407cc9e800 (diff) |
Revert "Fix ListView.isCurrentItem when used with DelegateModel"
This reverts commit d9f9d773e92940786f159897623618f3bf6bcf0f.
It causes a heap-use-after-free in tst_swipeview.qml.
Task-number: QTBUG-97423
Pick-to: 5.15 6.1 6.2
Change-Id: I42e9831ae1399a010df28c39496a7778121f5e35
Reviewed-by: Jan Arve Sæther <[email protected]>
Reviewed-by: Oliver Eftevaag <[email protected]>
-rw-r--r-- | src/quick/items/qquickitemview.cpp | 2 | ||||
-rw-r--r-- | tests/auto/quick/qquicklistview/data/qtbug86744.qml | 21 | ||||
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 15 |
3 files changed, 0 insertions, 38 deletions
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp index 9a7ed3f1b8..bd82fc14d3 100644 --- a/src/quick/items/qquickitemview.cpp +++ b/src/quick/items/qquickitemview.cpp @@ -2402,8 +2402,6 @@ void QQuickItemView::createdItem(int index, QObject* object) d->repositionPackageItemAt(item, index); else if (index == d->currentIndex) d->updateCurrent(index); - } else if (index == d->currentIndex) { - d->updateCurrent(index); } } diff --git a/tests/auto/quick/qquicklistview/data/qtbug86744.qml b/tests/auto/quick/qquicklistview/data/qtbug86744.qml deleted file mode 100644 index 6dc82d57eb..0000000000 --- a/tests/auto/quick/qquicklistview/data/qtbug86744.qml +++ /dev/null @@ -1,21 +0,0 @@ -import QtQuick 2.15 -import QtQml.Models 2.15 - -Item { - height: 200 - width: 100 - DelegateModel { - id: dm - model: 2 - delegate: Item { - width: 100; height: 20 - property bool isCurrent: ListView.isCurrentItem - } - } - ListView { - objectName: "listView" - model: dm - currentIndex: 1 - anchors.fill: parent - } -} diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index ac22a51a59..6975fa2dbd 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -303,7 +303,6 @@ private slots: void requiredObjectListModel(); void clickHeaderAndFooterWhenClip(); void animatedDelegate(); - void isCurrentItem_DelegateModel(); // WARNING: please add new tests to tst_qquicklistview2; this file is too slow to work with. @@ -10125,20 +10124,6 @@ void tst_QQuickListView::animatedDelegate() } } -void tst_QQuickListView::isCurrentItem_DelegateModel() -{ - QScopedPointer<QQuickView> window(createView()); - window->setSource(testFileUrl("qtbug86744.qml")); - window->resize(640, 480); - window->show(); - QVERIFY(QTest::qWaitForWindowExposed(window.data())); - - QQuickListView* listView = window->rootObject()->findChild<QQuickListView*>("listView"); - QVERIFY(listView); - QVariant value = listView->itemAtIndex(1)->property("isCurrent"); - QVERIFY(value.toBool() == true); -} - // WARNING: please add new tests to tst_qquicklistview2; this file is too slow to work with. QTEST_MAIN(tst_QQuickListView) |