aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlmodels/qqmladaptormodel.cpp
diff options
context:
space:
mode:
authorTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-01 22:03:58 +0200
committerTarja Sundqvist <tarja.sundqvist@qt.io>2023-03-01 22:03:58 +0200
commit15292659b7e77073ab19748199fdde06f27987b3 (patch)
tree4cc12fb1ce7d517e303620ab2028dea2e9406463 /src/qmlmodels/qqmladaptormodel.cpp
parent22b7e9c79182420ce1ff877d6636c0bdffde602d (diff)
parent7f07dae966bdd059b1dd1cb11c74ab5b89855396 (diff)
Merge remote-tracking branch 'origin/tqtc/lts-6.2.6' into tqtc/lts-6.2-opensource
Diffstat (limited to 'src/qmlmodels/qqmladaptormodel.cpp')
-rw-r--r--src/qmlmodels/qqmladaptormodel.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qmlmodels/qqmladaptormodel.cpp b/src/qmlmodels/qqmladaptormodel.cpp
index e55845d3e2..f283271018 100644
--- a/src/qmlmodels/qqmladaptormodel.cpp
+++ b/src/qmlmodels/qqmladaptormodel.cpp
@@ -967,7 +967,9 @@ void QQmlAdaptorModel::setModel(const QVariant &variant, QObject *)
{
accessors->cleanup(*this);
+ // Don't use variant anymore after this. list may transform it.
list.setList(variant);
+
modelStrongReference.clear();
if (QObject *object = qvariant_cast<QObject *>(list.list())) {
@@ -979,7 +981,7 @@ void QQmlAdaptorModel::setModel(const QVariant &variant, QObject *)
else
accessors = new VDMObjectDelegateDataType;
} else if (list.type() == QQmlListAccessor::ListProperty) {
- auto object = static_cast<const QQmlListReference *>(variant.constData())->object();
+ auto object = static_cast<const QQmlListReference *>(list.list().constData())->object();
if (QQmlData *ddata = QQmlData::get(object))
modelStrongReference = ddata->jsWrapper;
setObject(object);