QMetaType: Don't normalize name which should already be normalized

The name stored in a QMetaTypeInterface should already be normalized, as
a static metatype uses typenameHelper, which takes care of
normalization via QTypeNormalizer.
For dynamic metatypes, we don't have that guarantee, but those can only
be created by Qt, as there is no public API for it. We can thus ensure
that we only create normalized typenames (which we currently do anyway),
and skip the normalization in registerCustomType.

Change-Id: I18728031825cd39fdbe17cad0fbc6e3b5fd03c93
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
This commit is contained in:
Fabian Kosmale 2021-05-19 08:42:20 +02:00
parent c76a2d7c9c
commit f6fa4b39ee

View File

@ -120,11 +120,10 @@ struct QMetaTypeCustomRegistry
QWriteLocker l(&lock);
if (ti->typeId)
return ti->typeId;
QByteArray name =
QByteArray name = ti->name;
#ifndef QT_NO_QOBJECT
QMetaObject::normalizedType
Q_ASSERT(name == QMetaObject::normalizedType(ti->name));
#endif
(ti->name);
if (auto ti2 = aliases.value(name)) {
ti->typeId.storeRelaxed(ti2->typeId.loadRelaxed());
return ti2->typeId;