diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/kernel/qmetatype_p.h | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 5 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetsvariant.cpp | 3 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/corelib/kernel/qmetatype_p.h b/src/corelib/kernel/qmetatype_p.h index 2ab4a3896f..985cf71974 100644 --- a/src/corelib/kernel/qmetatype_p.h +++ b/src/corelib/kernel/qmetatype_p.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE namespace QModulesPrivate { enum Names { Core, Gui, Widgets, Unknown, ModulesCount /* ModulesCount has to be at the end */ }; -static inline int moduleForType(const int typeId) +static inline int moduleForType(const uint typeId) { if (typeId <= QMetaType::LastCoreType) return Core; diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 47c87098f8..296b845469 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -87,7 +87,7 @@ class HandlersManager { static const QVariant::Handler *Handlers[QModulesPrivate::ModulesCount]; public: - const QVariant::Handler *operator[] (const int typeId) const + const QVariant::Handler *operator[] (const uint typeId) const { return Handlers[QModulesPrivate::moduleForType(typeId)]; } @@ -776,6 +776,7 @@ static void customConstruct(QVariant::Private *d, const void *copy) const QMetaType type(d->type); const uint size = type.sizeOf(); if (!size) { + qWarning("Trying to construct an instance of an invalid type, type id: %i", d->type); d->type = QVariant::Invalid; return; } @@ -1700,7 +1701,7 @@ void QVariant::load(QDataStream &s) return; } } - create(static_cast<int>(typeId), 0); + create(typeId, 0); d.is_null = is_null; if (!isValid()) { diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp index f6817cec8a..15935a5886 100644 --- a/src/widgets/kernel/qwidgetsvariant.cpp +++ b/src/widgets/kernel/qwidgetsvariant.cpp @@ -62,7 +62,8 @@ static void construct(QVariant::Private *x, const void *copy) v_construct<QSizePolicy>(x, copy); break; default: - Q_ASSERT(false); + qWarning("Trying to construct an instance of an invalid type, type id: %i", x->type); + x->type = QVariant::Invalid; return; } x->is_null = !copy; |