path: root/src/corelib/kernel/qmetatype.h
diff options
authorFabian Kosmale <>2020-03-03 10:54:40 +0100
committerFabian Kosmale <>2020-03-03 14:14:00 +0100
commitcf000d080c61cde44bd84e53ee018f36e33b7257 (patch)
tree9110090fa532c4fbe165473b3dae3fde4f363071 /src/corelib/kernel/qmetatype.h
parent2f2d870fdd1e99d27fda6fa986f7de8a17ad0edf (diff)
QMetaType: support manual unregistration
QtDeclarative registers types in plugins, and supports un- and reloading those plugins. Those types would leave pointers to unmapped memory in the type registry on macOs, which would later cause crashes. We therefore add private API to manually remove the types from the registry, which can then be used in declarative. Lastly, as a precaution for re-registering the types, we reset QMetaTypeInterface::typeId to 0, as the memory is most likely not reset to 0 when reloading the plugin. Change-Id: Ic3fc08759f3d4481dca44a91b33baf3ea9e7198e Reviewed-by: Simon Hausmann <>
Diffstat (limited to 'src/corelib/kernel/qmetatype.h')
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index b9ab0cbca6..424065d247 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -693,6 +693,7 @@ public:
static void unregisterConverterFunction(int from, int to);
friend class QVariant;
+ friend class QtPrivate::QMetaTypeInterface;
QtPrivate::QMetaTypeInterface *d_ptr = nullptr;
@@ -2278,6 +2279,8 @@ public:
using LegacyRegisterOp = void (*)();
LegacyRegisterOp legacyRegisterOp;
+ Q_CORE_EXPORT static QMetaTypeInterface *get(const QMetaType &metatype);
struct QTypeNormalizer