diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp index c4f5e2a0fa..9438641147 100644 --- a/src/dbus/qdbusconnection.cpp +++ b/src/dbus/qdbusconnection.cpp @@ -895,7 +895,7 @@ bool QDBusConnection::registerObject(const QString &path, const QString &interfa QDBusWriteLocker locker(RegisterObjectAction, d); // lower-bound search for where this object should enter in the tree - QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator node = &d->rootNode; + QDBusConnectionPrivate::ObjectTreeNode *node = &d->rootNode; int i = 1; while (node) { if (pathComponents.count() == i) { @@ -934,7 +934,7 @@ bool QDBusConnection::registerObject(const QString &path, const QString &interfa std::lower_bound(node->children.begin(), node->children.end(), pathComponents.at(i)); if (it != node->children.end() && it->name == pathComponents.at(i)) { // match: this node exists - node = it; + node = &(*it); // are we allowed to go deeper? if (node->flags & ExportChildObjects) { @@ -945,7 +945,8 @@ bool QDBusConnection::registerObject(const QString &path, const QString &interfa } } else { // add entry - node = node->children.insert(it, pathComponents.at(i).toString()); + it = node->children.insert(it, pathComponents.at(i).toString()); + node = &(*it); } // iterate @@ -1017,7 +1018,7 @@ QObject *QDBusConnection::objectRegisteredAt(const QString &path) const if (it == node->children.constEnd() || it->name != pathComponents.at(i)) break; // node not found - node = it; + node = &(*it); ++i; } return nullptr; diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 6bf9ad7786..138c83ce57 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -385,7 +385,7 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root, start = 1; // walk the object tree - QDBusConnectionPrivate::ObjectTreeNode::DataList::ConstIterator node = root; + const QDBusConnectionPrivate::ObjectTreeNode *node = root; while (start < length && node) { if (node->flags & QDBusConnection::ExportChildObjects) break; @@ -399,7 +399,7 @@ static bool findObject(const QDBusConnectionPrivate::ObjectTreeNode *root, std::lower_bound(node->children.constBegin(), node->children.constEnd(), pathComponent); if (it != node->children.constEnd() && it->name == pathComponent) // match - node = it; + node = &(*it); else node = nullptr; @@ -624,7 +624,7 @@ static void huntAndUnregister(const QList &pathComponents, int i, if (it == end || it->name != pathComponents.at(i)) return; // node not found - huntAndUnregister(pathComponents, i + 1, mode, it); + huntAndUnregister(pathComponents, i + 1, mode, &(*it)); if (!it->isActive()) node->children.erase(it); }