Fix a deadlock in QMetaType.
QMetaType should unlock all mutexes guarding custom types data before calling an user code. Task-number: QTBUG-22930 Change-Id: I501d011d6cbd467d8f22402d668e84aa848061b8 Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
parent
8dca04f47f
commit
fa7f690178
@ -1430,10 +1430,12 @@ private:
|
|||||||
{
|
{
|
||||||
QMetaType::Constructor ctor = 0;
|
QMetaType::Constructor ctor = 0;
|
||||||
const QVector<QCustomTypeInfo> * const ct = customTypes();
|
const QVector<QCustomTypeInfo> * const ct = customTypes();
|
||||||
QReadLocker locker(customTypesLock());
|
{
|
||||||
if (type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User)
|
QReadLocker locker(customTypesLock());
|
||||||
return 0;
|
if (type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User)
|
||||||
ctor = ct->at(type - QMetaType::User).constructor;
|
return 0;
|
||||||
|
ctor = ct->at(type - QMetaType::User).constructor;
|
||||||
|
}
|
||||||
return ctor ? ctor(where, copy) : 0;
|
return ctor ? ctor(where, copy) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1519,10 +1521,12 @@ private:
|
|||||||
{
|
{
|
||||||
QMetaType::Destructor dtor = 0;
|
QMetaType::Destructor dtor = 0;
|
||||||
const QVector<QCustomTypeInfo> * const ct = customTypes();
|
const QVector<QCustomTypeInfo> * const ct = customTypes();
|
||||||
QReadLocker locker(customTypesLock());
|
{
|
||||||
if (type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User)
|
QReadLocker locker(customTypesLock());
|
||||||
return;
|
if (type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User)
|
||||||
dtor = ct->at(type - QMetaType::User).destructor;
|
return;
|
||||||
|
dtor = ct->at(type - QMetaType::User).destructor;
|
||||||
|
}
|
||||||
if (!dtor)
|
if (!dtor)
|
||||||
return;
|
return;
|
||||||
dtor(where);
|
dtor(where);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user