summaryrefslogtreecommitdiffstats
path: root/src/dbus
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbus')
-rw-r--r--src/dbus/qdbusargument.cpp1
-rw-r--r--src/dbus/qdbusintegrator.cpp41
-rw-r--r--src/dbus/qdbusmarshaller.cpp5
3 files changed, 22 insertions, 25 deletions
diff --git a/src/dbus/qdbusargument.cpp b/src/dbus/qdbusargument.cpp
index 3466d90..7defc9a 100644
--- a/src/dbus/qdbusargument.cpp
+++ b/src/dbus/qdbusargument.cpp
@@ -535,7 +535,6 @@ QDBusArgument &QDBusArgument::operator<<(const QByteArray &arg)
/*!
\internal
- Returns the type signature of the D-Bus type this QDBusArgument
\since 4.5
Appends the variant \a v.
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 30fa0b6..44abf7b 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -1660,9 +1660,6 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
}
QString busService = QLatin1String(DBUS_SERVICE_DBUS);
- WatchedServicesHash::mapped_type &bus = watchedServices[busService];
- bus.refcount = 1;
- bus.owner = getNameOwnerNoCache(busService);
connectSignal(busService, QString(), QString(), QLatin1String("NameAcquired"), QStringList(), QString(),
this, SLOT(registerService(QString)));
connectSignal(busService, QString(), QString(), QLatin1String("NameLost"), QStringList(), QString(),
@@ -2004,7 +2001,8 @@ bool QDBusConnectionPrivate::connectSignal(const QString &service,
entry.path == hook.path &&
entry.signature == hook.signature &&
entry.obj == hook.obj &&
- entry.midx == hook.midx) {
+ entry.midx == hook.midx &&
+ entry.argumentMatch == hook.argumentMatch) {
// no need to compare the parameters if it's the same slot
return true; // already there
}
@@ -2046,10 +2044,7 @@ void QDBusConnectionPrivate::connectSignal(const QString &key, const SignalHook
// Do we need to watch for this name?
if (shouldWatchService(hook.service)) {
WatchedServicesHash::mapped_type &data = watchedServices[hook.service];
- if (data.refcount) {
- // already watching
- ++data.refcount;
- } else {
+ if (++data.refcount == 1) {
// we need to watch for this service changing
QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS);
connectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS),
@@ -2089,7 +2084,8 @@ bool QDBusConnectionPrivate::disconnectSignal(const QString &service,
entry.path == hook.path &&
entry.signature == hook.signature &&
entry.obj == hook.obj &&
- entry.midx == hook.midx) {
+ entry.midx == hook.midx &&
+ entry.argumentMatch == hook.argumentMatch) {
// no need to compare the parameters if it's the same slot
disconnectSignal(it);
return true; // it was there
@@ -2105,19 +2101,6 @@ QDBusConnectionPrivate::disconnectSignal(SignalHookHash::Iterator &it)
{
const SignalHook &hook = it.value();
- WatchedServicesHash::Iterator sit = watchedServices.find(hook.service);
- if (sit != watchedServices.end()) {
- if (sit.value().refcount == 1) {
- watchedServices.erase(sit);
- QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS);
- disconnectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS),
- QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(),
- this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
- } else {
- --sit.value().refcount;
- }
- }
-
bool erase = false;
MatchRefCountHash::iterator i = matchRefCounts.find(hook.matchRule);
if (i == matchRefCounts.end()) {
@@ -2136,6 +2119,20 @@ QDBusConnectionPrivate::disconnectSignal(SignalHookHash::Iterator &it)
if (connection && erase) {
qDBusDebug("Removing rule: %s", hook.matchRule.constData());
q_dbus_bus_remove_match(connection, hook.matchRule, NULL);
+
+ // Successfully disconnected the signal
+ // Were we watching for this name?
+ WatchedServicesHash::Iterator sit = watchedServices.find(hook.service);
+ if (sit != watchedServices.end()) {
+ if (--sit.value().refcount == 0) {
+ watchedServices.erase(sit);
+ QString dbusServerService = QLatin1String(DBUS_SERVICE_DBUS);
+ disconnectSignal(dbusServerService, QString(), QLatin1String(DBUS_INTERFACE_DBUS),
+ QLatin1String("NameOwnerChanged"), QStringList() << hook.service, QString(),
+ this, SLOT(_q_serviceOwnerChanged(QString,QString,QString)));
+ }
+ }
+
}
return signalHooks.erase(it);
diff --git a/src/dbus/qdbusmarshaller.cpp b/src/dbus/qdbusmarshaller.cpp
index f156e04..8ec328e 100644
--- a/src/dbus/qdbusmarshaller.cpp
+++ b/src/dbus/qdbusmarshaller.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qdbusargument_p.h"
+#include "qdbusmetatype_p.h"
#include "qdbusutil_p.h"
QT_BEGIN_NAMESPACE
@@ -167,7 +168,7 @@ inline bool QDBusMarshaller::append(const QDBusVariant &arg)
QByteArray tmpSignature;
const char *signature = 0;
- if (int(id) == qMetaTypeId<QDBusArgument>()) {
+ if (int(id) == QDBusMetaTypeId::argument) {
// take the signature from the QDBusArgument object we're marshalling
tmpSignature =
qvariant_cast<QDBusArgument>(value).currentSignature().toLatin1();
@@ -353,7 +354,7 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
}
// intercept QDBusArgument parameters here
- if (id == qMetaTypeId<QDBusArgument>()) {
+ if (id == QDBusMetaTypeId::argument) {
QDBusArgument dbusargument = qvariant_cast<QDBusArgument>(arg);
QDBusArgumentPrivate *d = QDBusArgumentPrivate::d(dbusargument);
if (!d->message)