diff options
Diffstat (limited to 'src/dbus')
-rw-r--r-- | src/dbus/qdbusintegrator.cpp | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 6e37ea6f7c..e87ae5b29d 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -2038,34 +2038,15 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM QObject *receiver, const char *returnMethod, const char *errorMethod, int timeout) { - if (isServiceRegisteredByThread(message.service())) { + checkThread(); + + QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate(message, this); + bool isLoopback; + if ((isLoopback = isServiceRegisteredByThread(message.service()))) { // special case for local calls - QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate(message, this); pcall->replyMessage = sendWithReplyLocal(message); - if (receiver && returnMethod) - pcall->setReplyCallback(receiver, returnMethod); - - if (errorMethod) { - pcall->watcherHelper = new QDBusPendingCallWatcherHelper; - connect(pcall->watcherHelper, SIGNAL(error(QDBusError,QDBusMessage)), receiver, errorMethod, - Qt::QueuedConnection); - pcall->watcherHelper->moveToThread(thread()); - } - - if ((receiver && returnMethod) || errorMethod) { - // no one waiting, will delete pcall in processFinishedCall() - pcall->ref.store(1); - } else { - // set double ref to prevent race between processFinishedCall() and ref counting - // by QDBusPendingCall::QExplicitlySharedDataPointer<QDBusPendingCallPrivate> - pcall->ref.store(2); - } - processFinishedCall(pcall); - return pcall; } - checkThread(); - QDBusPendingCallPrivate *pcall = new QDBusPendingCallPrivate(message, this); if (receiver && returnMethod) pcall->setReplyCallback(receiver, returnMethod); @@ -2085,6 +2066,12 @@ QDBusPendingCallPrivate *QDBusConnectionPrivate::sendWithReplyAsync(const QDBusM pcall->ref.store(2); } + if (isLoopback) { + // a loopback call + processFinishedCall(pcall); + return pcall; + } + QDBusError error; DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message, capabilities, &error); if (!msg) { |