aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2021-04-08 13:50:46 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-04-09 09:05:00 +0000
commit81c2da0c7ccc361e3cc2206d30aaeb55065a5352 (patch)
treeb200431f91b8507d83d59a67cf5018dd4f390828 /src/qml
parent06b332fe74cd2dc6ae424edc84f06ea38d5b898e (diff)
Do not auto-clean components with live inline components
The inline components do not hold a strong reference to their outer type because that would be a reference cycle. Fixes: QTBUG-92236 Change-Id: I6d76a114352653210f0ece6c198cf761d3b4eda1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit d0d4cc528ba9e3c39c15a2292066dac1d457abd5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/qml/qqmlmetatype.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index 16aafac6d1..f74bec6003 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -1405,6 +1405,16 @@ void QQmlMetaType::unregisterType(int typeIndex)
}
}
+static bool hasActiveInlineComponents(const QQmlTypePrivate *d)
+{
+ for (const QQmlType &ic : qAsConst(d->objectIdToICType)) {
+ const QQmlTypePrivate *icPriv = ic.priv();
+ if (icPriv && icPriv->count() > 1)
+ return true;
+ }
+ return false;
+}
+
void QQmlMetaType::freeUnusedTypesAndCaches()
{
QQmlMetaTypeDataPtr data;
@@ -1419,7 +1429,7 @@ void QQmlMetaType::freeUnusedTypesAndCaches()
QList<QQmlType>::Iterator it = data->types.begin();
while (it != data->types.end()) {
const QQmlTypePrivate *d = (*it).priv();
- if (d && d->count() == 1) {
+ if (d && d->count() == 1 && !hasActiveInlineComponents(d)) {
deletedAtLeastOneType = true;
removeQQmlTypePrivate(data->idToType, d);