diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2018-02-02 10:24:57 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@qt.io> | 2018-02-06 09:10:16 +0000 |
commit | b1a2c519af2592beeaf1dfccdae2ec245492c92b (patch) | |
tree | 658b70586b02f5e1a5198fdd521b357c75f3053b | |
parent | 9e9131118cc12c2b77d1177407da1a353e26f466 (diff) |
QQmlDelegateModel: check incubationTask before accessing itwip/itemviews
A QQmlDelegateModelItem will have its incubation task removed
when the item has finished loading. So we need to check that
it exists before trying to access it. And we know that the
item is ready (and not in error state) if the item still
exists in the cache.
Change-Id: If25dca6b5902c491f5061b8d5d84046a72a8029b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
-rw-r--r-- | src/qml/types/qqmldelegatemodel.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp index fa1be563b5..491a918ce4 100644 --- a/src/qml/types/qqmldelegatemodel.cpp +++ b/src/qml/types/qqmldelegatemodel.cpp @@ -1044,7 +1044,10 @@ QQmlIncubator::Status QQmlDelegateModel::incubationStatus(int index) if (!it->inCache()) return QQmlIncubator::Null; - return d->m_cache.at(it.cacheIndex)->incubationTask->status(); + if (auto incubationTask = d->m_cache.at(it.cacheIndex)->incubationTask) + return incubationTask->status(); + + return QQmlIncubator::Ready; } QString QQmlDelegateModelPrivate::stringValue(Compositor::Group group, int index, const QString &name) @@ -3194,7 +3197,10 @@ QQmlIncubator::Status QQmlPartsModel::incubationStatus(int index) if (!it->inCache()) return QQmlIncubator::Null; - return model->m_cache.at(it.cacheIndex)->incubationTask->status(); + if (auto incubationTask = model->m_cache.at(it.cacheIndex)->incubationTask) + return incubationTask->status(); + + return QQmlIncubator::Ready; } int QQmlPartsModel::indexOf(QObject *item, QObject *) const |