path: root/src/dbus/qdbusserver.cpp
diff options
authorThiago Macieira <>2015-04-03 22:21:08 -0700
committerThiago Macieira <>2015-04-15 00:21:57 +0000
commitd370878aa0510e1e51eb9014965f505e395f3f81 (patch)
treeffdfd3c5b95f32fece7bbbe0febc9ba91d4bb6b6 /src/dbus/qdbusserver.cpp
parent2bcbe227bdcfded9ae01b289e78aa9e117613056 (diff)
Fix undefined behavior: accessing an object after destruction
QDBusConnectionPrivate keeps a pointer to a QDBusConnectionInterface, which in turn holds a reference back to that QDBusConnectionPrivate. During the interface object's destruction, the QDBusAbstractInterface's destructor checks if the interface is still valid. That access is undefined behavior, but has so far been benign in all our uses since the memory had not yet been freed (just destroyed) and the reference count went from 0 to -1. To be on the safe side, we destroy now the QDBusConnectionInterface object while the Private is still valid. It will bring the reference count down from 0 to a negative number, but won't cause any other effects. Change-Id: I9a75ad8521ae4e5cbbe5ffff13d1b80057e13809 Reviewed-by: Alex Blasche <>
Diffstat (limited to 'src/dbus/qdbusserver.cpp')
1 files changed, 1 insertions, 0 deletions
diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp
index 2fc7c75d83..cf1b6e9665 100644
--- a/src/dbus/qdbusserver.cpp
+++ b/src/dbus/qdbusserver.cpp
@@ -111,6 +111,7 @@ QDBusServer::~QDBusServer()
+ d->;