diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2013-01-16 19:41:49 +0800 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-23 07:54:00 +0100 |
commit | 3c6bb0ed8bfc9a2c679f4154585a16e47275ad21 (patch) | |
tree | c92aeb8ff742dd5c7af269fcbfb9a5f3bc22e85b /src/dbus/qdbusconnection.cpp | |
parent | 18c7ce5994126e7eb89e37c3d2bf6d528f84fdc3 (diff) |
Make the QtDBus object tree keep a count of active children
The new member variable activeChildren shall contain the number of
direct children that are active. This number differs from
children.count() because the vector may contain empty entries that
haven't been garbage-collected yet (obj == NULL and activeChildren ==
0).
When this count drops to zero, we know we can simply erase the vector of
children.
Change-Id: Ia20604d3fac852ea4a6e8862d934fbb936fa5e18
Reviewed-by: David Faure (KDE) <faure@kde.org>
Diffstat (limited to 'src/dbus/qdbusconnection.cpp')
-rw-r--r-- | src/dbus/qdbusconnection.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index 678b10d108..dd9417b87a 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -803,13 +803,8 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis return false; if (options & QDBusConnectionPrivate::VirtualObject) { - // technically the check for children needs to go even deeper - if (options & SubPath) { - foreach (const QDBusConnectionPrivate::ObjectTreeNode &child, node->children) { - if (child.obj) - return false; - } - } + if (options & SubPath && node->activeChildren) + return false; } else { if ((options & ExportChildObjects && !node->children.isEmpty())) return false; @@ -846,6 +841,7 @@ bool QDBusConnection::registerObject(const QString &path, QObject *object, Regis } } else { // add entry + ++node->activeChildren; node = node->children.insert(it, pathComponents.at(i)); } |