QtDBus: Use non-textual version of QMetaObject::invokeMethod

Use type-checked version for better run-time performance and
compile-time type checking.

Change-Id: I92c97d162137770bc373e28fa8e4e115ac5533e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ievgenii Meshcheriakov 2023-05-02 11:26:39 +02:00
parent 6f05e91695
commit 08a37f9cee
5 changed files with 9 additions and 6 deletions

View File

@ -37,7 +37,7 @@ QString MyObject::methodWithDelayedReply()
conn = connection();
msg = message();
setDelayedReply(true);
QMetaObject::invokeMethod(this, "process", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &MyObject::process, Qt::QueuedConnection);
return QString();
}
//! [0]

View File

@ -113,7 +113,7 @@ QDBusAbstractAdaptor::QDBusAbstractAdaptor(QObject* obj)
QDBusAdaptorConnector *connector = qDBusCreateAdaptorConnector(obj);
connector->waitingForPolish = true;
QMetaObject::invokeMethod(connector, "polish", Qt::QueuedConnection);
QMetaObject::invokeMethod(connector, &QDBusAdaptorConnector::polish, Qt::QueuedConnection);
}
/*!

View File

@ -370,7 +370,8 @@ public slots:
{
// This call cannot race with something disabling dispatch only because dispatch is
// never re-disabled from Qt code on an in-use connection once it has been enabled.
QMetaObject::invokeMethod(con, "setDispatchEnabled", Qt::QueuedConnection, Q_ARG(bool, true));
QMetaObject::invokeMethod(
con, [con = con]() { con->setDispatchEnabled(true); }, Qt::QueuedConnection);
if (!con->ref.deref())
con->deleteLater();
deleteLater();

View File

@ -1757,7 +1757,7 @@ void QDBusConnectionPrivate::setPeer(DBusConnection *c, const QDBusErrorInternal
watchForDBusDisconnection();
QMetaObject::invokeMethod(this, "doDispatch", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &QDBusConnectionPrivate::doDispatch, Qt::QueuedConnection);
}
static QDBusConnection::ConnectionCapabilities connectionCapabilies(DBusConnection *connection)
@ -1845,7 +1845,7 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
qDBusDebug() << this << ": connected successfully";
// schedule a dispatch:
QMetaObject::invokeMethod(this, "doDispatch", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, &QDBusConnectionPrivate::doDispatch, Qt::QueuedConnection);
}
extern "C"{

View File

@ -474,7 +474,9 @@ QDBusPendingCallWatcher::QDBusPendingCallWatcher(const QDBusPendingCall &call, Q
d->watcherHelper = new QDBusPendingCallWatcherHelper;
if (d->replyMessage.type() != QDBusMessage::InvalidMessage) {
// cause a signal emission anyways
QMetaObject::invokeMethod(d->watcherHelper, "finished", Qt::QueuedConnection);
QMetaObject::invokeMethod(d->watcherHelper,
&QDBusPendingCallWatcherHelper::finished,
Qt::QueuedConnection);
}
}
d->watcherHelper->add(this);