aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlmodels/qqmllistmodel.cpp
diff options
context:
space:
mode:
authorCathy Park <cathy.park@lge.com>2021-08-19 15:40:27 +0900
committerUlf Hermann <ulf.hermann@qt.io>2021-08-26 09:04:21 +0200
commit69e07c55ad9b49b7643ffddfedc9a558983272ad (patch)
tree76a4af945a430beee163182c51ba79589291462d /src/qmlmodels/qqmllistmodel.cpp
parent2ffd1ffb0e0ee6028849a279d36fe3f68fed1e99 (diff)
qqmllistmodel: Fix QObjects setting indestructible
It makes a QObject indestructable only if its ownership is determined. This fixes an issue where a QObject created by createObject() in QML becomes indestructable once it is appended to a ListModel. Fixes: QTBUG-95895 Pick-to: 6.2 Change-Id: I30647298977d7901dab938626e8f94b9910c21e3 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Jaeyoon Jung <jaeyoon.jung@lge.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src/qmlmodels/qqmllistmodel.cpp')
-rw-r--r--src/qmlmodels/qqmllistmodel.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qmlmodels/qqmllistmodel.cpp b/src/qmlmodels/qqmllistmodel.cpp
index a9c58d59a5..b71931cc85 100644
--- a/src/qmlmodels/qqmllistmodel.cpp
+++ b/src/qmlmodels/qqmllistmodel.cpp
@@ -1112,7 +1112,7 @@ static void setQObjectOwnership(char *mem, QObject *o)
if (!ddata)
ddata = QQmlData::get(o, true);
- ddata->indestructible = true;
+ ddata->indestructible = ownership != 0;
ddata->explicitIndestructibleSet = false;
new (mem) ListElement::GuardedQObjectPointer(