diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-05-25 20:39:41 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-05-26 14:46:39 +0200 |
commit | 348085dd7d1aeb83628eeb9687d70b0ba595dacd (patch) | |
tree | 12f7b8039edf329f829f92ecb6d7735363fe2c92 /src | |
parent | 0472a7a4326cf9ac1abdcbc0910c3b13f5c4fb5a (diff) |
Add dynamically-created pointer handlers to parent's resources
Fixes: QTBUG-94005
Change-Id: I609620627682e3e95c284adf897b08007e3e0726
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquickitem.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index eed3f8daae..3fcbabd263 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -3272,9 +3272,8 @@ void QQuickItemPrivate::data_append(QQmlListProperty<QObject> *prop, QObject *o) } } o->setParent(that); + resources_append(prop, o); } - - resources_append(prop, o); } } @@ -8658,6 +8657,13 @@ void QQuickItemPrivate::addPointerHandler(QQuickPointerHandler *h) auto &handlers = extra.value().pointerHandlers; if (!handlers.contains(h)) handlers.prepend(h); + auto &res = extra.value().resourcesList; + if (!res.contains(h)) { + res.append(h); + QObject::connect(h, &QObject::destroyed, q, [this](QObject *o) { + _q_resourceObjectDeleted(o); + }); + } } #if QT_CONFIG(quick_shadereffect) |