aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-02-14 12:24:55 +0100
committerUlf Hermann <ulf.hermann@qt.io>2023-02-17 08:15:29 +0100
commit5d5e41ed73450a122aa4eaa09bcc38125deedd4b (patch)
treef8cc492a864aeb823eb54287bbfc239881941a6b /src/qml
parentdc77e09f8696bc8a382fdae234d3c7869e9d3be8 (diff)
QQmlMetaType: Clear property caches on qmlClearTypeRegistrations
Otherwise we may retain dangling pointers referencing invalid property caches. Some metaobjects are created on the heap. If the memory manager decides to re-use the heap space for new metaobjects, we can retrieve the invalid property caches. Task-number: QTBUG-110933 Change-Id: Ic00bb852151bcf58ba6ae798a6bf2cea686a9e10 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 6937f2e50dd60c58350a464eb83ba9d11c7146f9)
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/qml/qqmlmetatype.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index a4ed418548..4b73984636 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -337,6 +337,10 @@ void QQmlMetaType::clearTypeRegistrations()
data->urlToNonFileImportType.clear();
data->metaObjectToType.clear();
data->undeletableTypes.clear();
+
+ for (auto it = data->propertyCaches.begin(), end = data->propertyCaches.end(); it != end; ++it)
+ (*it)->release();
+ data->propertyCaches.clear();
}
int QQmlMetaType::registerAutoParentFunction(const QQmlPrivate::RegisterAutoParent &function)