summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-12-08 20:28:45 +0100
committerThiago Macieira <thiago.macieira@nokia.com>2009-12-09 10:15:29 +0100
commit970f19bdb55cd559e9ef97228d30fd52b20e39cb (patch)
tree1a807904533630fede6cdc423a85a686af89f5a1 /src
parent0b78ccc201f58b53c90e6327b051bfdb8c08ee14 (diff)
Fix crash in QDBusPendingReply/QDBusReply in case of unconnected calls.
If we made calls on a QDBusConnection that isn't connected, the d pointer is 0. Ensure we don't crash. Task-number: QTBUG-6571 Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'src')
-rw-r--r--src/dbus/qdbuspendingcall.cpp2
-rw-r--r--src/dbus/qdbuspendingreply.h1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp
index d10179e1f2..d8eb53e32b 100644
--- a/src/dbus/qdbuspendingcall.cpp
+++ b/src/dbus/qdbuspendingcall.cpp
@@ -310,7 +310,7 @@ QDBusPendingCall &QDBusPendingCall::operator=(const QDBusPendingCall &other)
bool QDBusPendingCall::isFinished() const
{
- return d && (d->replyMessage.type() != QDBusMessage::InvalidMessage);
+ return !d || (d->replyMessage.type() != QDBusMessage::InvalidMessage);
}
void QDBusPendingCall::waitForFinished()
diff --git a/src/dbus/qdbuspendingreply.h b/src/dbus/qdbuspendingreply.h
index b7f54e430c..4f90c986de 100644
--- a/src/dbus/qdbuspendingreply.h
+++ b/src/dbus/qdbuspendingreply.h
@@ -188,6 +188,7 @@ public:
private:
inline void calculateMetaTypes()
{
+ if (!d) return;
int typeIds[Count > 0 ? Count : 1]; // use at least one since zero-sized arrays aren't valid
ForEach::fillMetaTypes(typeIds);
setMetaTypes(Count, typeIds);