QDBusServer: Remove private slot

Use QMetaObject::invokeMethod() to schedule call to
QDBusConnectionPrivate::_q_newConnectioni() instead.
This also gets rid of a by name signal/slot connection.

Change-Id: I8725c4e3815c5580c5561bdddda0ab722b06346e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
bb10
Ievgenii Meshcheriakov 2023-08-23 14:29:01 +02:00
parent f87d214000
commit d865e3ef1d
4 changed files with 4 additions and 8 deletions

View File

@ -214,6 +214,8 @@ public:
void enableDispatchDelayed(QObject *context);
void _q_newConnection(QDBusConnectionPrivate *newConnection);
private:
void checkThread();
bool handleError(const QDBusErrorInternal &error);
@ -241,8 +243,6 @@ private:
void watchForDBusDisconnection();
void _q_newConnection(QDBusConnectionPrivate *newConnection);
void handleAuthentication();
bool addSignalHook(const QString &key, const SignalHook &hook);
@ -275,7 +275,6 @@ signals:
void messageNeedsSending(QDBusPendingCallPrivate *pcall, void *msg, int timeout = -1);
void serviceOwnerChanged(const QString &name, const QString &oldOwner, const QString &newOwner);
void callWithCallbackFailed(const QDBusError &error, const QDBusMessage &message);
void newServerConnection(QDBusConnectionPrivate *newConnection);
public:
QAtomicInt ref;

View File

@ -316,7 +316,8 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v
newConnection->setDispatchEnabled(false);
// this is a queued connection and will resume in the QDBusServer's thread
emit serverConnection->newServerConnection(newConnection);
QMetaObject::invokeMethod(serverConnection, &QDBusConnectionPrivate::_q_newConnection,
Qt::QueuedConnection, newConnection);
// we've disabled dispatching of events, so now we post an event to the
// QDBusServer's thread in order to enable it after the

View File

@ -40,9 +40,6 @@ QDBusServer::QDBusServer(const QString &address, QObject *parent)
instance->createServer(address, this);
Q_ASSERT(d != nullptr);
QObject::connect(d, SIGNAL(newServerConnection(QDBusConnectionPrivate*)),
this, SLOT(_q_newConnection(QDBusConnectionPrivate*)), Qt::QueuedConnection);
}
/*!

View File

@ -37,7 +37,6 @@ Q_SIGNALS:
private:
Q_DISABLE_COPY(QDBusServer)
Q_PRIVATE_SLOT(d, void _q_newConnection(QDBusConnectionPrivate*))
QDBusConnectionPrivate *d;
friend class QDBusConnectionPrivate;
};