invokeMethod: replace a local RAII struct with qScopeGuard

Change-Id: I3991c6f212cf78ef5cbdf562168817ae87d5c703
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Mårten Nordheim 2023-06-27 17:05:49 +02:00
parent efc6b9946b
commit e1b2af4d02

View File

@ -1613,11 +1613,7 @@ bool QMetaObject::invokeMethodImpl(QObject *obj, const char *member, Qt::Connect
bool QMetaObject::invokeMethodImpl(QObject *object, QtPrivate::QSlotObjectBase *slot, Qt::ConnectionType type, void *ret)
{
struct Holder {
QtPrivate::QSlotObjectBase *obj;
~Holder() { obj->destroyIfLastRef(); }
} holder = { slot };
Q_UNUSED(holder);
auto slotGuard = qScopeGuard([slot] { slot->destroyIfLastRef(); });
if (! object)
return false;