summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusintegrator.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-12-29 18:06:42 -0200
committerThiago Macieira <thiago.macieira@intel.com>2015-09-15 02:08:29 +0000
commit1996bd4a01748ae384242eb47d4ff2c679c4c5d0 (patch)
treeeed28a9b350dd0386212c0041d62a93d66536e6b /src/dbus/qdbusintegrator.cpp
parent2bcc913a7f302cc404efcba951565bdeab9e1de4 (diff)
Use QDBusConnectionPrivate* when QDBusServer receives a new connection
This is because the socket activity will move to a different thread; QDBusConnectionPrivate* can be queued, QDBusConnection can't easily. Change-Id: I82722016018b7fcfb246cda6043469fadbfd987d Reviewed-by: Albert Astals Cid <aacid@kde.org> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/dbus/qdbusintegrator.cpp')
-rw-r--r--src/dbus/qdbusintegrator.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 796f41bffc..04d2c93ffe 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2015 Intel Corporation.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtDBus module of the Qt Toolkit.
@@ -52,6 +53,7 @@
#include "qdbusmetatype_p.h"
#include "qdbusabstractadaptor.h"
#include "qdbusabstractadaptor_p.h"
+#include "qdbusserver.h"
#include "qdbusutil_p.h"
#include "qdbusvirtualobject.h"
#include "qdbusmessage_p.h"
@@ -393,10 +395,14 @@ static void qDBusNewConnection(DBusServer *server, DBusConnection *connection, v
QDBusErrorInternal error;
newConnection->setPeer(connection, error);
- QDBusConnection retval = QDBusConnectionPrivate::q(newConnection);
+ // this is a queued connection and will resume in the QDBusServer's thread
+ emit serverConnection->newServerConnection(newConnection);
+}
- // make QDBusServer emit the newConnection signal
- serverConnection->serverConnection(retval);
+void QDBusConnectionPrivate::_q_newConnection(QDBusConnectionPrivate *newConnection)
+{
+ Q_ASSERT(mode == ServerMode);
+ emit serverObject->newConnection(QDBusConnectionPrivate::q(newConnection));
}
} // extern "C"
@@ -1645,9 +1651,10 @@ void QDBusConnectionPrivate::handleSignal(const QDBusMessage& msg)
handleSignal(key, msg); // third try
}
-void QDBusConnectionPrivate::setServer(DBusServer *s, const QDBusErrorInternal &error)
+void QDBusConnectionPrivate::setServer(QDBusServer *object, DBusServer *s, const QDBusErrorInternal &error)
{
mode = ServerMode;
+ serverObject = object;
if (!s) {
handleError(error);
return;