summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusintegrator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbus/qdbusintegrator.cpp')
-rw-r--r--src/dbus/qdbusintegrator.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 6269d9ece3..b310483d11 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -554,7 +554,7 @@ qDBusSignalFilter(DBusConnection *connection, DBusMessage *message, void *data)
bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg)
{
const QDBusSpyHookList *list = qDBusSpyHookList();
- for (int i = 0; i < list->size(); ++i) {
+ for (int i = 0; list && i < list->size(); ++i) {
qDBusDebug() << "calling the message spy hook";
(*(*list)[i])(amsg);
}
@@ -1038,6 +1038,15 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate()
"Timer and socket errors will follow and the program will probably crash",
qPrintable(name));
+ if (mode == ClientMode) {
+ // the bus service object holds a reference back to us;
+ // we need to destroy it before we finish destroying ourselves
+ Q_ASSERT(ref.load() == 0);
+ QObject *obj = (QObject *)busService;
+ disconnect(obj, Q_NULLPTR, this, Q_NULLPTR);
+ delete obj;
+ }
+
closeConnection();
rootNode.children.clear(); // free resources
qDeleteAll(cachedMetaObjects);