aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicklistview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/items/qquicklistview.cpp')
-rw-r--r--src/quick/items/qquicklistview.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/quick/items/qquicklistview.cpp b/src/quick/items/qquicklistview.cpp
index 063c48260a..7c5ef85566 100644
--- a/src/quick/items/qquicklistview.cpp
+++ b/src/quick/items/qquicklistview.cpp
@@ -1704,18 +1704,23 @@ void QQuickListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExte
break;
}
}
- FxViewItem *topItem = snapItemAt(tempPosition + snapOffset + highlightRangeStart);
- if (strictHighlightRange && currentItem && (!topItem || (topItem->index != currentIndex && fixupMode == Immediate))) {
- // StrictlyEnforceRange always keeps an item in range
+
+ // If there are pending changes, the item returned from snapItemAt might get deleted as
+ // soon as applyPendingChanges() is called (from e.g. updateHighlight()).
+ // Therefore, apply the pending changes before we call snapItemAt()
+ if (strictHighlightRange)
updateHighlight();
- topItem = currentItem;
- }
+
+ FxViewItem *topItem = snapItemAt(tempPosition + snapOffset + highlightRangeStart);
FxViewItem *bottomItem = snapItemAt(tempPosition + snapOffset + highlightRangeEnd);
- if (strictHighlightRange && currentItem && (!bottomItem || (bottomItem->index != currentIndex && fixupMode == Immediate))) {
+ if (strictHighlightRange && currentItem) {
// StrictlyEnforceRange always keeps an item in range
- updateHighlight();
- bottomItem = currentItem;
+ if (!topItem || (topItem->index != currentIndex && fixupMode == Immediate))
+ topItem = currentItem;
+ if (!bottomItem || (bottomItem->index != currentIndex && fixupMode == Immediate))
+ bottomItem = currentItem;
}
+
qreal pos = 0;
bool isInBounds = -position() > maxExtent && -position() <= minExtent;