Remove wrong assert from QMetaType.
We can't assert that QMetaType helper arrays are initialized. In rare situations it may happen that QMetaType compiled without support for an external type (without compiled Gui or Widgets libraries) will be asked for additional information for the type. For example (assuming Qt is compiled with --no-gui): // typeId it may be received over network (QMetaType::QImage) void *ptr = QMetaType::create(typeId); Change-Id: I018a59b23def35c7574e7c921019b5db4f06e800 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
parent
64a735eed6
commit
ae9afa6b9e
@ -1435,12 +1435,10 @@ class TypeConstructor {
|
||||
{
|
||||
QMetaType::Constructor ctor = 0;
|
||||
if (QTypeModuleInfo<T>::IsGui) {
|
||||
Q_ASSERT(qMetaTypeGuiHelper);
|
||||
if (!qMetaTypeGuiHelper)
|
||||
return 0;
|
||||
ctor = qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].constructor;
|
||||
} else if (QTypeModuleInfo<T>::IsWidget) {
|
||||
Q_ASSERT(qMetaTypeWidgetsHelper);
|
||||
if (!qMetaTypeWidgetsHelper)
|
||||
return 0;
|
||||
ctor = qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].constructor;
|
||||
@ -1527,12 +1525,10 @@ class TypeDestructor {
|
||||
{
|
||||
QMetaType::Destructor dtor = 0;
|
||||
if (QTypeModuleInfo<T>::IsGui) {
|
||||
Q_ASSERT(qMetaTypeGuiHelper);
|
||||
if (!qMetaTypeGuiHelper)
|
||||
return;
|
||||
dtor = qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].destructor;
|
||||
} else if (QTypeModuleInfo<T>::IsWidget) {
|
||||
Q_ASSERT(qMetaTypeWidgetsHelper);
|
||||
if (!qMetaTypeWidgetsHelper)
|
||||
return;
|
||||
dtor = qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].destructor;
|
||||
@ -1601,12 +1597,10 @@ class SizeOf {
|
||||
static int Size(const int type)
|
||||
{
|
||||
if (QTypeModuleInfo<T>::IsGui) {
|
||||
Q_ASSERT(qMetaTypeGuiHelper);
|
||||
if (!qMetaTypeGuiHelper)
|
||||
return 0;
|
||||
return qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].size;
|
||||
} else if (QTypeModuleInfo<T>::IsWidget) {
|
||||
Q_ASSERT(qMetaTypeWidgetsHelper);
|
||||
if (!qMetaTypeWidgetsHelper)
|
||||
return 0;
|
||||
return qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].size;
|
||||
|
Loading…
Reference in New Issue
Block a user