QDBusConnectionPrivate: Emit newConnection signal on QDBusServer directly

Remove indirection via _q_newConnection() because the server object
may not exist anymore when this method is invoked.

This amends commit d865e3ef1d.

Task-number: QTBUG-116621
Change-Id: I5f9a667bc0e2e3cd36492c24767505031fe0e1d7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
bb10
Ievgenii Meshcheriakov 2023-09-01 16:17:48 +02:00
parent 2b06d41b46
commit 074c664b5c
2 changed files with 2 additions and 10 deletions

View File

@ -214,8 +214,6 @@ public:
void enableDispatchDelayed(QObject *context);
void _q_newConnection(QDBusConnectionPrivate *newConnection);
private:
void checkThread();
bool handleError(const QDBusErrorInternal &error);

View File

@ -316,8 +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
QMetaObject::invokeMethod(serverConnection, &QDBusConnectionPrivate::_q_newConnection,
Qt::QueuedConnection, newConnection);
QMetaObject::invokeMethod(serverConnection->serverObject, &QDBusServer::newConnection,
Qt::QueuedConnection, QDBusConnectionPrivate::q(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
@ -329,12 +329,6 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v
} // extern "C"
void QDBusConnectionPrivate::_q_newConnection(QDBusConnectionPrivate *newConnection)
{
Q_ASSERT(mode == ServerMode);
emit serverObject->newConnection(QDBusConnectionPrivate::q(newConnection));
}
static QByteArray buildMatchRule(const QString &service,
const QString &objectPath, const QString &interface,
const QString &member, const QDBusConnectionPrivate::ArgMatchRules &argMatch, const QString & /*signature*/)