aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickgridview.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2019-05-13 14:19:01 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2019-06-04 14:18:28 +0000
commit1aa4eab4a68e19702b5b3ab9b831efdc35266e66 (patch)
tree0ed935be0ce3f8bc22b2c36a6bdf354e15529051 /src/quick/items/qquickgridview.cpp
parent7940d57b53817f28e1a575a7c37aeed968fb2f61 (diff)
Fix heap-use-after-free with QQuickListView
Ensure we stop FXViewItems from tracking so we don't have pointers to dead QQuickListViewPrivate object on QQuickItem destruction. Fixes: QTBUG-71581 Change-Id: I80291086697b1455d9319969fe5cba0ea4d04a73 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/quick/items/qquickgridview.cpp')
-rw-r--r--src/quick/items/qquickgridview.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index 6638fbd3e8..fecfa5fd2d 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -191,7 +191,7 @@ public:
void resetFirstItemPosition(qreal pos = 0.0) override;
void adjustFirstItem(qreal forwards, qreal backwards, int changeBeforeVisible) override;
- void createHighlight() override;
+ void createHighlight(bool onDestruction = false) override;
void updateHighlight() override;
void resetHighlightPosition() override;
@@ -696,9 +696,8 @@ void QQuickGridViewPrivate::adjustFirstItem(qreal forwards, qreal backwards, int
gridItem->setPosition(gridItem->colPos(), gridItem->rowPos() + ((moveCount / columns) * rowSize()));
}
-void QQuickGridViewPrivate::createHighlight()
+void QQuickGridViewPrivate::createHighlight(bool onDestruction)
{
- Q_Q(QQuickGridView);
bool changed = false;
if (highlight) {
if (trackedItem == highlight)
@@ -714,6 +713,10 @@ void QQuickGridViewPrivate::createHighlight()
changed = true;
}
+ if (onDestruction)
+ return;
+
+ Q_Q(QQuickGridView);
if (currentItem) {
QQuickItem *item = createHighlightItem();
if (item) {