diff options
Diffstat (limited to 'src/dbus/qdbusintegrator.cpp')
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index f6221d51b6..c4e506ff0e 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -208,14 +208,14 @@ static dbus_bool_t qDBusAddWatch(DBusWatch *watch, void *data) watcher.watch = watch; watcher.read = new QSocketNotifier(fd, QSocketNotifier::Read, d); watcher.read->setEnabled(q_dbus_watch_get_enabled(watch)); - d->connect(watcher.read, SIGNAL(activated(int)), SLOT(socketRead(int))); + d->connect(watcher.read, &QSocketNotifier::activated, d, &QDBusConnectionPrivate::socketRead); } if (flags & DBUS_WATCH_WRITABLE) { //qDebug("addWriteWatch %d", fd); watcher.watch = watch; watcher.write = new QSocketNotifier(fd, QSocketNotifier::Write, d); watcher.write->setEnabled(q_dbus_watch_get_enabled(watch)); - d->connect(watcher.write, SIGNAL(activated(int)), SLOT(socketWrite(int))); + d->connect(watcher.write, &QSocketNotifier::activated, d, &QDBusConnectionPrivate::socketWrite); } d->watchers.insertMulti(fd, watcher); @@ -522,15 +522,14 @@ bool QDBusConnectionPrivate::handleMessage(const QDBusMessage &amsg) static void huntAndDestroy(QObject *needle, QDBusConnectionPrivate::ObjectTreeNode &haystack) { - QDBusConnectionPrivate::ObjectTreeNode::DataList::Iterator it = haystack.children.begin(); + for (auto &node : haystack.children) + huntAndDestroy(needle, node); - while (it != haystack.children.end()) { - huntAndDestroy(needle, *it); - if (!it->isActive()) - it = haystack.children.erase(it); - else - it++; - } + auto isInactive = [](QDBusConnectionPrivate::ObjectTreeNode &node) { return !node.isActive(); }; + + haystack.children.erase(std::remove_if(haystack.children.begin(), haystack.children.end(), + isInactive), + haystack.children.end()); if (needle == haystack.obj) { haystack.obj = 0; @@ -887,7 +886,7 @@ void QDBusConnectionPrivate::deliverCall(QObject *object, int /*flags*/, const Q *reinterpret_cast<const QDBusArgument *>(arg.constData()); QVariant &out = auxParameters[auxParameters.count() - 1]; - if (!QDBusMetaType::demarshall(in, out.userType(), out.data())) + if (Q_UNLIKELY(!QDBusMetaType::demarshall(in, out.userType(), out.data()))) qFatal("Internal error: demarshalling function for type '%s' (%d) failed!", out.typeName(), out.userType()); @@ -1921,8 +1920,8 @@ QDBusMessage QDBusConnectionPrivate::sendWithReply(const QDBusMessage &message, if (sendMode == QDBus::BlockWithGui) { pcall->watcherHelper = new QDBusPendingCallWatcherHelper; QEventLoop loop; - loop.connect(pcall->watcherHelper, SIGNAL(reply(QDBusMessage)), SLOT(quit())); - loop.connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), SLOT(quit())); + loop.connect(pcall->watcherHelper, &QDBusPendingCallWatcherHelper::reply, &loop, &QEventLoop::quit); + loop.connect(pcall->watcherHelper, &QDBusPendingCallWatcherHelper::error, &loop, &QEventLoop::quit); // enter the event loop and wait for a reply loop.exec(QEventLoop::ExcludeUserInputEvents | QEventLoop::WaitForMoreEvents); @@ -2107,7 +2106,7 @@ void QDBusConnectionPrivate::addSignalHook(const QString &key, const SignalHook } signalHooks.insertMulti(key, hook); - connect(hook.obj, SIGNAL(destroyed(QObject*)), SLOT(objectDestroyed(QObject*)), + connect(hook.obj, &QObject::destroyed, this, &QDBusConnectionPrivate::objectDestroyed, Qt::ConnectionType(Qt::BlockingQueuedConnection | Qt::UniqueConnection)); MatchRefCountHash::iterator mit = matchRefCounts.find(hook.matchRule); @@ -2233,7 +2232,7 @@ QDBusConnectionPrivate::removeSignalHookNoLock(SignalHookHash::Iterator it) void QDBusConnectionPrivate::registerObject(const ObjectTreeNode *node) { - connect(node->obj, SIGNAL(destroyed(QObject*)), SLOT(objectDestroyed(QObject*)), + connect(node->obj, &QObject::destroyed, this, &QDBusConnectionPrivate::objectDestroyed, Qt::ConnectionType(Qt::BlockingQueuedConnection | Qt::UniqueConnection)); if (node->flags & (QDBusConnection::ExportAdaptors |