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 /tests | |
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 'tests')
-rw-r--r-- | tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp index ffcc2ddcdc..3c08f8999c 100644 --- a/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp +++ b/tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp @@ -1200,6 +1200,19 @@ void tst_QDBusConnection::registerVirtualObject() QVERIFY(!con.registerVirtualObject(path, &obj, QDBusConnection::SubPath)); QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(0)); } + + { + // Register object, make sure no SubPath handling object can be registered on a parent path. + // (same as above, but deeper) + QObject objectAtSubPath; + QVERIFY(con.registerObject(childChildPath, &objectAtSubPath)); + QCOMPARE(con.objectRegisteredAt(childChildPath), static_cast<QObject *>(&objectAtSubPath)); + + VirtualObject obj; + QVERIFY(!con.registerVirtualObject(path, &obj, QDBusConnection::SubPath)); + QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(0)); + } + QCOMPARE(con.objectRegisteredAt(path), static_cast<QObject *>(0)); QCOMPARE(con.objectRegisteredAt(childPath), static_cast<QObject *>(0)); QCOMPARE(con.objectRegisteredAt(childChildPath), static_cast<QObject *>(0)); |