aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickrepeater.cpp
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-04-21 10:34:03 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2020-04-22 09:05:04 +0200
commit28a31148ca02dbb530fd92dfafbcf71c64af4b70 (patch)
tree3779220bb6ae6a732ef3f8a65d031a1dd210af72 /src/quick/items/qquickrepeater.cpp
parentac3a6d9fb3caf19ec345f4eba8747149446c4f20 (diff)
QQuickRepeater: Fix interaction with Package
Amends 3b806a18cc665b5ae0e12d45fe170bfc3f00352a. Eric's change tried to tackle the issue by making the PartModel more well-behaved. However, this still left some issues, as exhibited by the linked bug. This time, we simply make the repeater more robust, and setup d->deletables if it's not done yet. Pick-to: 5.15 Fixes: QTBUG-71964 Change-Id: I58c80c84f73fddaea5d6030f92ffff219ecf2b71 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/quick/items/qquickrepeater.cpp')
-rw-r--r--src/quick/items/qquickrepeater.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp
index 20603720c5..6dc735d20b 100644
--- a/src/quick/items/qquickrepeater.cpp
+++ b/src/quick/items/qquickrepeater.cpp
@@ -417,6 +417,12 @@ void QQuickRepeater::createdItem(int index, QObject *)
void QQuickRepeater::initItem(int index, QObject *object)
{
Q_D(QQuickRepeater);
+ if (index >= d->deletables.size()) {
+ // this can happen when Package is used
+ // calling regenerate does too much work, all we need is to call resize
+ // so that d->deletables[index] = item below works
+ d->deletables.resize(d->model->count() + 1);
+ }
QQuickItem *item = qmlobject_cast<QQuickItem*>(object);
if (!d->deletables.at(index)) {