summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusintegrator.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-01-01 22:06:18 -0200
committerThiago Macieira <thiago.macieira@intel.com>2015-01-11 03:39:40 +0100
commitfb166648936410f791ae6e600756d255b4a50545 (patch)
treeb28dce8b7f28a8b933268478610e66b86c43de74 /src/dbus/qdbusintegrator.cpp
parenta90bb5b89a09490a1795064133f6d8ce33b6874e (diff)
Fix memory leaks with QDBusServer
Two serious mistakes: - we need to call dbus_server_free_data_slot as many times as we call dbus_server_allocate_data_slot - we need to delete the d pointer... The changes to the unit tests are simply to cause the used peer connections to be removed so they don't show up in valgrind. Change-Id: I9fd1ada5503db9ba481806c09116874ee81f450d Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/dbus/qdbusintegrator.cpp')
-rw-r--r--src/dbus/qdbusintegrator.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index dd92602dce..698fb1b46c 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -66,6 +66,9 @@
QT_BEGIN_NAMESPACE
+// used with dbus_server_allocate_data_slot
+static dbus_int32_t server_slot = -1;
+
static QBasicAtomicInt isDebugging = Q_BASIC_ATOMIC_INITIALIZER(-1);
#define qDBusDebug if (::isDebugging == 0); else qDebug
@@ -1084,8 +1087,10 @@ void QDBusConnectionPrivate::closeConnection()
mode = InvalidMode; // prevent reentrancy
baseService.clear();
- if (server)
+ if (server) {
q_dbus_server_disconnect(server);
+ q_dbus_server_free_data_slot(&server_slot);
+ }
if (oldMode == ClientMode || oldMode == PeerMode) {
if (connection) {
@@ -1651,8 +1656,6 @@ void QDBusConnectionPrivate::handleSignal(const QDBusMessage& msg)
handleSignal(key, msg); // third try
}
-static dbus_int32_t server_slot = -1;
-
void QDBusConnectionPrivate::setServer(DBusServer *s, const QDBusErrorInternal &error)
{
mode = ServerMode;