diff options
Diffstat (limited to 'src/dbus/qdbusintegrator.cpp')
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 325cee6bae..bc49d6816e 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -2224,6 +2224,19 @@ QDBusConnectionPrivate::disconnectSignal(SignalHookHash::Iterator &it) return signalHooks.erase(it); } + +static void cleanupDeletedNodes(QDBusConnectionPrivate::ObjectTreeNode &parent) +{ + QMutableVectorIterator<QDBusConnectionPrivate::ObjectTreeNode> it(parent.children); + while (it.hasNext()) { + QDBusConnectionPrivate::ObjectTreeNode& node = it.next(); + if (node.obj == 0 && node.children.isEmpty()) + it.remove(); + else + cleanupDeletedNodes(node); + } +} + void QDBusConnectionPrivate::registerObject(const ObjectTreeNode *node) { connect(node->obj, SIGNAL(destroyed(QObject*)), SLOT(objectDestroyed(QObject*)), @@ -2247,6 +2260,10 @@ void QDBusConnectionPrivate::registerObject(const ObjectTreeNode *node) this, SLOT(relaySignal(QObject*,const QMetaObject*,int,QVariantList)), Qt::DirectConnection); } + + static int counter = 0; + if ((++counter % 20) == 0) + cleanupDeletedNodes(rootNode); } void QDBusConnectionPrivate::connectRelay(const QString &service, |