Fix a race condition between QObject::connect and qRegisterMetaType
QObject::connect will extract the QArgumentType for first the signal, then the slot. The QArgumentType with a string constructor will query the metatype system to get the meta type id. But it might happen that between the extraction of the signal's argument and the slot's argument, qRegisterMetaType was called in another thread. For this reason, it's possible that one QArgumentType has a type id while the other does not. For this reason, we should fall back to compare the string if any of the argument's type is 0. Task-number: QTBUG-50901 Change-Id: I260ca662ff00a773ae519f78bb633e05fde0ea81 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
7de8745eaa
commit
5426e689f9
|
|
@ -143,21 +143,17 @@ public:
|
|||
}
|
||||
bool operator==(const QArgumentType &other) const
|
||||
{
|
||||
if (_type)
|
||||
if (_type && other._type)
|
||||
return _type == other._type;
|
||||
else if (other._type)
|
||||
return false;
|
||||
else
|
||||
return _name == other._name;
|
||||
return name() == other.name();
|
||||
}
|
||||
bool operator!=(const QArgumentType &other) const
|
||||
{
|
||||
if (_type)
|
||||
if (_type && other._type)
|
||||
return _type != other._type;
|
||||
else if (other._type)
|
||||
return true;
|
||||
else
|
||||
return _name != other._name;
|
||||
return name() != other.name();
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
|||
Loading…
Reference in New Issue