Port QObjectPrivate::connect() to SlotObjUniquePtr internally
This is for consistency with QObject::connectImpl() and QObjectPrivate::connectImpl(), if nothing else. See the commit message of the QObject::connectImpl() porting patch for why we leave the function signature unchanged (key-word: tail-callability). Pick-to: 6.6 6.5 Change-Id: I515d3be4a5126f9f4738dd7bde5174377faf2343 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
18857db2dd
commit
ff75ace02d
@ -5334,20 +5334,19 @@ QMetaObject::Connection QObjectPrivate::connect(const QObject *sender, int signa
|
|||||||
*/
|
*/
|
||||||
QMetaObject::Connection QObjectPrivate::connect(const QObject *sender, int signal_index,
|
QMetaObject::Connection QObjectPrivate::connect(const QObject *sender, int signal_index,
|
||||||
const QObject *receiver,
|
const QObject *receiver,
|
||||||
QtPrivate::QSlotObjectBase *slotObj,
|
QtPrivate::QSlotObjectBase *slotObjRaw,
|
||||||
Qt::ConnectionType type)
|
Qt::ConnectionType type)
|
||||||
{
|
{
|
||||||
|
QtPrivate::SlotObjUniquePtr slotObj(slotObjRaw);
|
||||||
if (!sender) {
|
if (!sender) {
|
||||||
qCWarning(lcConnect, "QObject::connect: invalid nullptr parameter");
|
qCWarning(lcConnect, "QObject::connect: invalid nullptr parameter");
|
||||||
if (slotObj)
|
|
||||||
slotObj->destroyIfLastRef();
|
|
||||||
return QMetaObject::Connection();
|
return QMetaObject::Connection();
|
||||||
}
|
}
|
||||||
const QMetaObject *senderMetaObject = sender->metaObject();
|
const QMetaObject *senderMetaObject = sender->metaObject();
|
||||||
signal_index = methodIndexToSignalIndex(&senderMetaObject, signal_index);
|
signal_index = methodIndexToSignalIndex(&senderMetaObject, signal_index);
|
||||||
|
|
||||||
return QObjectPrivate::connectImpl(sender, signal_index, receiver, /*slot*/ nullptr, slotObj,
|
return connectImpl(sender, signal_index, receiver, /*slot*/ nullptr, slotObj.release(),
|
||||||
type, /*types*/ nullptr, senderMetaObject);
|
type, /*types*/ nullptr, senderMetaObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Loading…
Reference in New Issue
Block a user