aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlmetatype.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-06-29 16:28:07 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-06-29 21:52:03 +0200
commite16c2d3919113104a7233810b64aabbaf364f4fa (patch)
tree0264739e3b3af998d0b06a62ff1f7276b640f214 /src/qml/qml/qqmlmetatype.cpp
parent5e12e609692f67f97339d556c9d8e5f50f50aae8 (diff)
QQmlMetaTypeData: Key nameToType by QHashedString
As the new QMultiHash does not store a separate copy of the key for each value, we'd get dangling string references when the "wrong" values were removed. Change-Id: I4ccf6db8bdbf4d38ef393b66b61b285ce763f5c2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlmetatype.cpp')
-rw-r--r--src/qml/qml/qqmlmetatype.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index e3b93c4c61..cf51279bda 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -1225,7 +1225,8 @@ QQmlType QQmlMetaType::qmlType(const QHashedStringRef &name, const QHashedString
{
const QQmlMetaTypeDataPtr data;
- QQmlMetaTypeData::Names::ConstIterator it = data->nameToType.constFind(name);
+ const QHashedString key(QString::fromRawData(name.constData(), name.length()), name.hash());
+ QQmlMetaTypeData::Names::ConstIterator it = data->nameToType.constFind(key);
while (it != data->nameToType.cend() && it.key() == name) {
QQmlType t(*it);
if (module.isEmpty() || t.availableInVersion(module, version))