diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 92ad38613b7..fc222ad9e8a 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -87,8 +87,9 @@ struct QMetaTypeCustomRegistry #endif (ti->name); if (auto ti2 = aliases.value(name)) { - ti->typeId.storeRelaxed(ti2->typeId.loadRelaxed()); - return ti2->typeId; + const auto id = ti2->typeId.loadRelaxed(); + ti->typeId.storeRelaxed(id); + return id; } aliases[name] = ti; int size = registry.size(); @@ -2555,7 +2556,7 @@ static int qMetaTypeCustomType_unlocked(const char *typeName, int length) Q_ASSERT(!reg->lock.tryLockForWrite()); #endif if (auto ti = reg->aliases.value(QByteArray::fromRawData(typeName, length), nullptr)) { - return ti->typeId; + return ti->typeId.loadRelaxed(); } } return QMetaType::UnknownType;