diff options
Diffstat (limited to 'src/dbus/qdbusserver.cpp')
-rw-r--r-- | src/dbus/qdbusserver.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp index 3189b4e..abc5cb3 100644 --- a/src/dbus/qdbusserver.cpp +++ b/src/dbus/qdbusserver.cpp @@ -41,6 +41,7 @@ #include "qdbusserver.h" #include "qdbusconnection_p.h" +#include "qdbusconnectionmanager_p.h" #ifndef QT_NO_DBUS @@ -71,7 +72,8 @@ QDBusServer::QDBusServer(const QString &address, QObject *parent) } d = new QDBusConnectionPrivate(this); - d->name = QLatin1String("QDBusServer-") + QString::number(reinterpret_cast<qulonglong>(d)); + 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))); @@ -81,6 +83,17 @@ QDBusServer::QDBusServer(const QString &address, QObject *parent) } /*! + Destructs a QDBusServer +*/ +QDBusServer::~QDBusServer() +{ + if (QDBusConnectionManager::instance()) { + QMutexLocker locker(&QDBusConnectionManager::instance()->mutex); + QDBusConnectionManager::instance()->removeConnection(d->name); + } +} + +/*! Returns true if this QDBusServer object is connected. If it isn't connected, you need to call the constructor again. |