summaryrefslogtreecommitdiffstats
path: root/src/dbus
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-05-05 18:48:46 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2009-05-07 08:57:34 (GMT)
commit83566cfac942c8ca7620cf95ae47655d6ff475c3 (patch)
treefed90947705d2c91bf9d21b799222e2ec76250e5 /src/dbus
parent0d8434ecfec5a088bc0c755964dae1dfcb35305e (diff)
downloadQt-83566cfac942c8ca7620cf95ae47655d6ff475c3.zip
Qt-83566cfac942c8ca7620cf95ae47655d6ff475c3.tar.gz
Qt-83566cfac942c8ca7620cf95ae47655d6ff475c3.tar.bz2
Make QDBusPendingCallWatcher emit a signal if it is created on an
already-finished call. This fixes a bit of a "surprise" when calling a local method (which returns and finishes immediately) or when by accident calling a function that returns QDBusReply instead of QDBusPendingCall/Reply. Reviewed-by: Trust Me
Diffstat (limited to 'src/dbus')
-rw-r--r--src/dbus/qdbuspendingcall.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp
index 9753bbe..955f4a0 100644
--- a/src/dbus/qdbuspendingcall.cpp
+++ b/src/dbus/qdbuspendingcall.cpp
@@ -432,9 +432,14 @@ inline void QDBusPendingCallWatcherPrivate::_q_finished()
QDBusPendingCallWatcher::QDBusPendingCallWatcher(const QDBusPendingCall &call, QObject *parent)
: QObject(*new QDBusPendingCallWatcherPrivate, parent), QDBusPendingCall(call)
{
- if (d) {
- if (!d->watcherHelper)
+ if (d) { // QDBusPendingCall::d
+ if (!d->watcherHelper) {
d->watcherHelper = new QDBusPendingCallWatcherHelper;
+ if (isFinished()) {
+ // cause a signal emission anyways
+ QMetaObject::invokeMethod(d->watcherHelper, "finished", Qt::QueuedConnection);
+ }
+ }
d->watcherHelper->add(this);
}
}
@@ -464,6 +469,7 @@ void QDBusPendingCallWatcher::waitForFinished()
d->waitForFinished();
// our signals were queued, so deliver them
+ QCoreApplication::sendPostedEvents(d->watcherHelper, QEvent::MetaCall);
QCoreApplication::sendPostedEvents(this, QEvent::MetaCall);
}
}