qt5-qtdeclarative/0018-Revert-Fix-ListView.isCurrentItem-when-used-with-Del.patch

95 lines
3.1 KiB
Diff
Raw Permalink Normal View History

From 45d43c04088efb8346979f633f72bb1f23183461 Mon Sep 17 00:00:00 2001
From: Mitch Curtis <mitch.curtis@qt.io>
Date: Thu, 4 Nov 2021 10:41:28 +0100
Subject: [PATCH 18/18] Revert "Fix ListView.isCurrentItem when used with
DelegateModel"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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 <jan-arve.saether@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
(cherry picked from commit 5d656b31eb371c9e0bb97c558f9193b08471f1d7)
---
src/quick/items/qquickitemview.cpp | 2 --
.../quick/qquicklistview/data/qtbug86744.qml | 21 -------------------
.../qquicklistview/tst_qquicklistview.cpp | 14 -------------
3 files changed, 37 deletions(-)
delete mode 100644 tests/auto/quick/qquicklistview/data/qtbug86744.qml
diff --git a/src/quick/items/qquickitemview.cpp b/src/quick/items/qquickitemview.cpp
index c8ea286d3e..f8ad168a17 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 df329f8318..b564fd3ba5 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -10201,20 +10201,6 @@ void tst_QQuickListView::dragDelegateWithMouseArea_data()
}
}
-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);
-}
-
QTEST_MAIN(tst_QQuickListView)
#include "tst_qquicklistview.moc"
--
2.37.3