diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-04-08 13:50:46 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-04-09 12:14:25 +0200 |
commit | 4a5b989755cc7e92a3d9045c37d272ee114c702a (patch) | |
tree | aa78ac8e19b56b96619c30e9213877d7ef4096f5 /src | |
parent | 028a80801d52edb5dd8f47387ae675b925883f9c (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)
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/qml/qqmlmetatype.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp index 8a1bbd9459..e4699d0b55 100644 --- a/src/qml/qml/qqmlmetatype.cpp +++ b/src/qml/qml/qqmlmetatype.cpp @@ -1260,6 +1260,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; @@ -1274,7 +1284,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); |