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;
|
||||
const QVector<QCustomTypeInfo> * const ct = customTypes();
|
||||
QReadLocker locker(customTypesLock());
|
||||
if (type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User)
|
||||
return 0;
|
||||
ctor = ct->at(type - QMetaType::User).constructor;
|
||||
{
|
||||
QReadLocker locker(customTypesLock());
|
||||
if (type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User)
|
||||
return 0;
|
||||
ctor = ct->at(type - QMetaType::User).constructor;
|
||||
}
|
||||
return ctor ? ctor(where, copy) : 0;
|
||||
}
|
||||
|
||||
@ -1519,10 +1521,12 @@ private:
|
||||
{
|
||||
QMetaType::Destructor dtor = 0;
|
||||
const QVector<QCustomTypeInfo> * const ct = customTypes();
|
||||
QReadLocker locker(customTypesLock());
|
||||
if (type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User)
|
||||
return;
|
||||
dtor = ct->at(type - QMetaType::User).destructor;
|
||||
{
|
||||
QReadLocker locker(customTypesLock());
|
||||
if (type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User)
|
||||
return;
|
||||
dtor = ct->at(type - QMetaType::User).destructor;
|
||||
}
|
||||
if (!dtor)
|
||||
return;
|
||||
dtor(where);
|
||||
|
Loading…
x
Reference in New Issue
Block a user