summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusconnection_p.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-01-16 19:41:49 +0800
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-01-23 07:54:00 +0100
commit3c6bb0ed8bfc9a2c679f4154585a16e47275ad21 (patch)
treec92aeb8ff742dd5c7af269fcbfb9a5f3bc22e85b /src/dbus/qdbusconnection_p.h
parent18c7ce5994126e7eb89e37c3d2bf6d528f84fdc3 (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_p.h')
-rw-r--r--src/dbus/qdbusconnection_p.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index 50307e2738..3beb258bd8 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -140,14 +140,16 @@ public:
{
typedef QVector<ObjectTreeNode> DataList;
- inline ObjectTreeNode() : obj(0), flags(0) { }
+ inline ObjectTreeNode() : obj(0), flags(0), activeChildren(0) { }
inline ObjectTreeNode(const QString &n) // intentionally implicit
- : name(n), obj(0), flags(0) { }
+ : name(n), obj(0), flags(0), activeChildren(0) { }
inline ~ObjectTreeNode() { }
inline bool operator<(const QString &other) const
{ return name < other; }
inline bool operator<(const QStringRef &other) const
{ return QStringRef(&name) < other; }
+ inline bool isActive() const
+ { return obj || activeChildren; }
QString name;
union {
@@ -155,6 +157,7 @@ public:
QDBusVirtualObject *treeNode;
};
int flags;
+ int activeChildren;
DataList children;
};