From bc0bf6f84034267d1e15ca9ca31e6498e6d97bd3 Mon Sep 17 00:00:00 2001 From: "Daniele E. Domenichelli" Date: Mon, 18 Apr 2011 11:21:06 -0500 Subject: QtDBus: Fix registering objects using path '/' in peer-to-peer connections Merge-request: 2343 Reviewed-by: Marius Storm-Olsen Reviewed-by: Thiago Macieira --- src/dbus/qdbusconnection.cpp | 2 +- src/dbus/qdbusintegrator.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index a7ee5b9..f78d7da 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -814,7 +814,7 @@ void QDBusConnection::unregisterObject(const QString &path, UnregisterMode mode) // find the object while (node) { - if (pathComponents.count() == i) { + if (pathComponents.count() == i || !path.compare(QLatin1String("/"))) { // found it node->obj = 0; node->flags = 0; diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index e09b155..10f749b 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -430,6 +430,11 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root, const QString &fullpath, int &usedLength, QDBusConnectionPrivate::ObjectTreeNode &result) { + if (!fullpath.compare(QLatin1String("/")) && root->obj) { + usedLength = 1; + result = *root; + return root; + } int start = 0; int length = fullpath.length(); if (fullpath.at(0) == QLatin1Char('/')) -- cgit v0.12