QMetaType: Ensure that qfloat16 gets correct id
Code initially compiled against Qt <= 6.2 does not have a qfloat16 metatype that unconditionally gets registeret from QtBase. Therefore, any preexisting metatype instance for qfloat16 will hit the custom type registry code path. As builtin metatypes are not part of the custom registry, we will create a new type-id, and the type will thus not compare equal to new code using the builtin type-id. Avoid this issue by inserting an alias to the type in QMetaTypeCustomRegistry's constructor. Pick-to: 6.5 dev Change-Id: I825265ad16e274c08b2c4a3a4814475b6c6c6187 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
parent
973f499cca
commit
b68ad5ef7f
@ -84,6 +84,20 @@ struct QMetaTypeDeleter
|
||||
|
||||
struct QMetaTypeCustomRegistry
|
||||
{
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED)
|
||||
QMetaTypeCustomRegistry()
|
||||
{
|
||||
/* qfloat16 was neither a builtin, nor unconditionally registered
|
||||
in QtCore in Qt <= 6.2.
|
||||
Inserting it as an alias ensures that a QMetaType::id call
|
||||
will get the correct built-in type-id (the interface pointers
|
||||
might still not match, but we already deal with that case.
|
||||
*/
|
||||
aliases.insert("qfloat16", QtPrivate::qMetaTypeInterfaceForType<qfloat16>());
|
||||
}
|
||||
#endif
|
||||
|
||||
QReadWriteLock lock;
|
||||
QList<const QtPrivate::QMetaTypeInterface *> registry;
|
||||
QHash<QByteArray, const QtPrivate::QMetaTypeInterface *> aliases;
|
||||
|
Loading…
x
Reference in New Issue
Block a user