diff options
-rw-r--r-- | src/dbus/qdbusconnection.cpp | 21 | ||||
-rw-r--r-- | src/dbus/qdbusconnection.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 6df95ec..dea7cf9 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -466,6 +466,27 @@ void QDBusConnection::disconnectFromBus(const QString &name) } /*! + \since 4.8 + + Closes the peer connection of name \a name. + + Note that if there are still QDBusConnection objects associated + with the same connection, the connection will not be closed until + all references are dropped. However, no further references can be + created using the QDBusConnection constructor. +*/ +void QDBusConnection::disconnectFromPeer(const QString &name) +{ + if (_q_manager()) { + QMutexLocker locker(&_q_manager()->mutex); + QDBusConnectionPrivate *d = _q_manager()->connection(name); + if(d && d->mode != QDBusConnectionPrivate::PeerMode) + return; + _q_manager()->removeConnection(name); + } +} + +/*! Sends the \a message over this connection, without waiting for a reply. This is suitable for errors, signals, and return values as well as calls whose return values are not necessary. diff --git a/src/dbus/qdbusconnection.h b/src/dbus/qdbusconnection.h index 8aa0726..15e08a7 100644 --- a/src/dbus/qdbusconnection.h +++ b/src/dbus/qdbusconnection.h @@ -174,6 +174,7 @@ public: static QDBusConnection connectToBus(const QString &address, const QString &name); static QDBusConnection connectToPeer(const QString &address, const QString &name); static void disconnectFromBus(const QString &name); + static void disconnectFromPeer(const QString &name); static QDBusConnection sessionBus(); static QDBusConnection systemBus(); |