QMetaObject: fix check for void's metatype in metaType()

Pointer comparison is not sufficient on most platforms.

Change-Id: I6f936da6f6e84d649f70fffd1706f8b1f0654a1e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Thiago Macieira 2022-07-31 10:02:35 -07:00
parent a4e0f070ae
commit 777c7a2288

View File

@ -6,6 +6,7 @@
#include "qmetatype.h"
#include "qobject.h"
#include "qmetaobject_p.h"
#include "qmetatype_p.h"
#include <qcoreapplication.h>
#include <qcoreevent.h>
@ -405,7 +406,7 @@ QMetaType QMetaObject::metaType() const
data:QMetaType(prop0), ..., QMetaType(propPropCount-1), QMetaType(class),...
*/
auto iface = this->d.metaTypes[d->propertyCount];
if (iface == QtPrivate::qMetaTypeInterfaceForType<void>())
if (iface && QtMetaTypePrivate::isInterfaceFor<void>(iface))
return QMetaType(); // return invalid meta-type for namespaces
if (iface)
return QMetaType(iface);