summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusintegrator.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-11-19 12:21:04 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-11-24 20:29:53 (GMT)
commit8a820c790f2316052819148e344a3cd197877433 (patch)
treec89750f9efe2ee7681d829b334e7cfecdfda1f3f /src/dbus/qdbusintegrator.cpp
parent70d0d80e5cc11f98778234ddd20ce668551e9d9d (diff)
downloadQt-8a820c790f2316052819148e344a3cd197877433.zip
Qt-8a820c790f2316052819148e344a3cd197877433.tar.gz
Qt-8a820c790f2316052819148e344a3cd197877433.tar.bz2
Fix the detection of when this process gets names on the bus.
Previously, we were relying on NameOwnerChanged to notify us of our own names. This worked because we got all NameOwnerChanged that happened on the bus. Now, we only get those we're interested in. Instead of watching for newOwner==baseService, let's just use the NameAcquired and NameLost signals, that the D-Bus server sends to us anyway. Task-number: QTBUG-5979
Diffstat (limited to 'src/dbus/qdbusintegrator.cpp')
-rw-r--r--src/dbus/qdbusintegrator.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 870ddd0..40febc4 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -948,9 +948,6 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p)
rootNode.flags = 0;
watchedServiceNames[QLatin1String(DBUS_SERVICE_DBUS)] = 1;
-
- connect(this, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
- this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
}
QDBusConnectionPrivate::~QDBusConnectionPrivate()
@@ -1180,11 +1177,7 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in
void QDBusConnectionPrivate::_q_serviceOwnerChanged(const QString &name,
const QString &oldOwner, const QString &newOwner)
{
- if (oldOwner == baseService)
- unregisterService(name);
- if (newOwner == baseService)
- registerService(name);
-
+ Q_UNUSED(oldOwner);
QDBusWriteLocker locker(UpdateSignalHookOwnerAction, this);
QMutableHashIterator<QString, SignalHook> it(signalHooks);
it.toFront();
@@ -1655,9 +1648,16 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
baseService = QString::fromUtf8(service);
} else {
- qWarning("QDBusConnectionPrivate::SetConnection: Unable to get base service");
+ qWarning("QDBusConnectionPrivate::setConnection: Unable to get base service");
}
+ QString busService = QLatin1String(DBUS_SERVICE_DBUS);
+ connectSignal(busService, QString(), QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(),
+ this, SLOT(registerService(QString)));
+ connectSignal(busService, QString(), QString(), QString(), QLatin1String("NameLost"), QStringList(), QString(),
+ this, SLOT(unregisterService(QString)));
+
+
q_dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0);
//qDebug("base service: %s", service);