summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusserver.cpp
diff options
context:
space:
mode:
authorJan Arne Petersen <jpetersen@openismus.com>2012-03-23 13:58:04 +0100
committerQt by Nokia <qt-info@nokia.com>2012-09-14 01:02:06 +0200
commita386194f9952683c0be5028f2b7f0ce9617fe404 (patch)
tree4ca5fe5802000566450f5eff7ed6784067b9804f /src/dbus/qdbusserver.cpp
parent019bb22ff1f340a9b14d4f93898c6cda376ee1a0 (diff)
Fix QDBusServer with more than one connection
Create a new QDBusConnectionPrivate for every new connection in qDBusNewConnection instead of creating a single QDBusConnectionPrivate in the QDBusServer constructor which gets assigned the latest connected DBusConnection in qDBusNewConnection (and loses track on all previous DBusConnections). Also extend tst_QDBusConnection::registerObjectPeer() test with multiple connections to the server. Task-Number: 24921 Change-Id: I4341e8d48d464f3fe0a314a6ab14f848545d65a0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/dbus/qdbusserver.cpp')
-rw-r--r--src/dbus/qdbusserver.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp
index 32471dfe5d..280ae92d69 100644
--- a/src/dbus/qdbusserver.cpp
+++ b/src/dbus/qdbusserver.cpp
@@ -71,9 +71,6 @@ QDBusServer::QDBusServer(const QString &address, QObject *parent)
}
d = new QDBusConnectionPrivate(this);
- QMutexLocker locker(&QDBusConnectionManager::instance()->mutex);
- QDBusConnectionManager::instance()->setConnection(QLatin1String("QDBusServer-") + QString::number(reinterpret_cast<qulonglong>(d)), d);
-
QObject::connect(d, SIGNAL(newServerConnection(QDBusConnection)),
this, SIGNAL(newConnection(QDBusConnection)));
@@ -96,9 +93,6 @@ QDBusServer::QDBusServer(QObject *parent)
}
d = new QDBusConnectionPrivate(this);
- QMutexLocker locker(&QDBusConnectionManager::instance()->mutex);
- QDBusConnectionManager::instance()->setConnection(QLatin1String("QDBusServer-") + QString::number(reinterpret_cast<qulonglong>(d)), d);
-
QObject::connect(d, SIGNAL(newServerConnection(QDBusConnection)),
this, SIGNAL(newConnection(QDBusConnection)));
@@ -113,7 +107,10 @@ QDBusServer::~QDBusServer()
{
if (QDBusConnectionManager::instance()) {
QMutexLocker locker(&QDBusConnectionManager::instance()->mutex);
- QDBusConnectionManager::instance()->removeConnection(d->name);
+ Q_FOREACH (const QString &name, d->serverConnectionNames) {
+ QDBusConnectionManager::instance()->removeConnection(name);
+ }
+ d->serverConnectionNames.clear();
}
}