diff options
author | Kirill Burtsev <kirill.burtsev@qt.io> | 2019-03-14 18:41:03 +0100 |
---|---|---|
committer | Kirill Burtsev <kirill.burtsev@qt.io> | 2019-03-15 16:39:54 +0000 |
commit | f396cc753da75c68c6a501379a18df3099697f42 (patch) | |
tree | b9adb58445b75457529ee64556467c85dcfe9c8a /src/qml/util | |
parent | 132dd00457f53f69822af2a21ad14b7bcbcca7db (diff) |
Fix leaking propertyCache inside QQmlAdaptorModel::Accessors
QQmlRefPointer works in AddRef mode for assignment of a raw pointer.
This creates additional reference to original object and it will never
be garbage collected in this case. Amends change 99e2356a73.
Task-number: QTBUG-74148
Change-Id: Ic0f03e842965c5c82b357d10ab8b0d6a62411fc8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/util')
-rw-r--r-- | src/qml/util/qqmladaptormodel.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp index d9cb6506b8..a9a38c5381 100644 --- a/src/qml/util/qqmladaptormodel.cpp +++ b/src/qml/util/qqmladaptormodel.cpp @@ -525,7 +525,7 @@ public: metaObject.reset(builder.toMetaObject()); *static_cast<QMetaObject *>(this) = *metaObject; - propertyCache = new QQmlPropertyCache(metaObject.data(), model.modelItemRevision); + propertyCache.adopt(new QQmlPropertyCache(metaObject.data(), model.modelItemRevision)); } }; @@ -659,8 +659,8 @@ public: { VDMListDelegateDataType *dataType = const_cast<VDMListDelegateDataType *>(this); if (!propertyCache) { - dataType->propertyCache = new QQmlPropertyCache( - &QQmlDMListAccessorData::staticMetaObject, model.modelItemRevision); + dataType->propertyCache.adopt(new QQmlPropertyCache( + &QQmlDMListAccessorData::staticMetaObject, model.modelItemRevision)); } return new QQmlDMListAccessorData( |