aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlmodels/qqmltableinstancemodel_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-02-18 15:16:54 +0100
committerUlf Hermann <ulf.hermann@qt.io>2020-02-27 12:37:47 +0100
commit83fdcbf3be0ddbbee1fd2c8c9ff1a4e3c707e3f0 (patch)
tree905cea7f82dc45897c94da4dc6dc19fcfbaa67a1 /src/qmlmodels/qqmltableinstancemodel_p.h
parent86b3f39566ec597243718edb87498a653648457a (diff)
QQmlTableInstanceModel: Fix refcounting of metatypes
The reusable items pool should only hold unreferenced objects. Therefore, we can immediately delete them when draining. release() is not suitable here because it unconditionally decreases and therefore underflows the refcount. Furthermore, the metatype is also refcounted, which means we should keep it in a QQmlRefCounter in order to not leak references. Task-number: QTBUG-82000 Change-Id: Iefdaaecc34342eb2e3b1e5a3281f2e46ac472347 Reviewed-by: Joni Poikelin <joni.poikelin@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qmlmodels/qqmltableinstancemodel_p.h')
-rw-r--r--src/qmlmodels/qqmltableinstancemodel_p.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qmlmodels/qqmltableinstancemodel_p.h b/src/qmlmodels/qqmltableinstancemodel_p.h
index 1ea5ee7401..fd5968d872 100644
--- a/src/qmlmodels/qqmltableinstancemodel_p.h
+++ b/src/qmlmodels/qqmltableinstancemodel_p.h
@@ -142,7 +142,7 @@ private:
QQmlAbstractDelegateComponent *m_delegateChooser = nullptr;
QQmlComponent *m_delegate = nullptr;
QPointer<QQmlContext> m_qmlContext;
- QQmlDelegateModelItemMetaType *m_metaType;
+ QQmlRefPointer<QQmlDelegateModelItemMetaType> m_metaType;
QHash<int, QQmlDelegateModelItem *> m_modelItems;
QList<QQmlDelegateModelItem *> m_reusableItemsPool;