diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2016-05-03 17:03:26 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2016-05-03 18:58:24 +0000 |
commit | 69c2a606b36858454ec0b53b5d9789cf8e524806 (patch) | |
tree | 86a97816b5e4bf4be5937774f5b8fd2a126b8086 /src/dbus | |
parent | 224db5e6eb07154ba2e974a96ee617bf7d740134 (diff) | |
parent | 6357813207c866c99aadfd91af8fb3affe891f1d (diff) |
Merge "Merge remote-tracking branch 'origin/5.7' into dev" into refs/staging/dev
Diffstat (limited to 'src/dbus')
-rw-r--r-- | src/dbus/qdbusconnection_p.h | 1 | ||||
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 26 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index 83a2e6fc32..b2fa8faae8 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -259,6 +259,7 @@ private: const QVector<int> &metaTypes, int slotIdx); SignalHookHash::Iterator removeSignalHookNoLock(SignalHookHash::Iterator it); + void disconnectObjectTree(ObjectTreeNode &node); bool isServiceRegisteredByThread(const QString &serviceName); diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 105714ee64..6d4a27cdb5 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -1055,7 +1055,6 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate() qPrintable(name)); closeConnection(); - rootNode.children.clear(); // free resources qDeleteAll(cachedMetaObjects); if (mode == ClientMode || mode == PeerMode) { @@ -1077,6 +1076,19 @@ QDBusConnectionPrivate::~QDBusConnectionPrivate() } } +void QDBusConnectionPrivate::disconnectObjectTree(QDBusConnectionPrivate::ObjectTreeNode &haystack) +{ + QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it = haystack.children.begin(); + + while (it != haystack.children.end()) { + disconnectObjectTree(*it); + it++; + } + + if (haystack.obj) + haystack.obj->disconnect(this); +} + void QDBusConnectionPrivate::closeConnection() { QDBusWriteLocker locker(CloseConnectionAction, this); @@ -1100,6 +1112,18 @@ void QDBusConnectionPrivate::closeConnection() } qDeleteAll(pendingCalls); + + // Disconnect all signals from signal hooks and from the object tree to + // avoid QObject::destroyed being sent to dbus daemon thread which has + // already quit. + SignalHookHash::iterator sit = signalHooks.begin(); + while (sit != signalHooks.end()) { + sit.value().obj->disconnect(this); + sit++; + } + + disconnectObjectTree(rootNode); + rootNode.children.clear(); // free resources } void QDBusConnectionPrivate::checkThread() |