summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbuspendingcall.cpp
diff options
context:
space:
mode:
authorPeter Seiderer <ps.report@gmx.net>2013-06-17 22:44:30 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-07-29 22:28:58 +0200
commit6c21f42657b494e24112c90d8b9fff719f1f8791 (patch)
treefeecc49a9431d7f97f7c11102b9468300ee03fba /src/dbus/qdbuspendingcall.cpp
parent72ecf5a7ecb688a7e19cbc2f70e358a94d02edf7 (diff)
Change QDBusPendingCallPrivate to full reference counting for deletion.
Fixes race between QDBusConnectionPrivate::processFinishedCall() releasing the mutex before emitting signals (using various members of QDBusPendingCallPrivate) and deletion of the QDBusPendingCallPrivate object through QDBusPendingCall::d's destructor (a member of type QExplicitlySharedDataPointer<QDBusPendingCallPrivate>) leeds to segmentation fault with CrashTest example on slow/single core arm cpu). Task-number: QTBUG-27809 Change-Id: I3590d74d1cfa5816ede764b50b83a7008ec780ff Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/dbus/qdbuspendingcall.cpp')
-rw-r--r--src/dbus/qdbuspendingcall.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp
index 0b4ff3a397..49f9fc0cd8 100644
--- a/src/dbus/qdbuspendingcall.cpp
+++ b/src/dbus/qdbuspendingcall.cpp
@@ -256,6 +256,11 @@ QDBusPendingCall::QDBusPendingCall(const QDBusPendingCall &other)
QDBusPendingCall::QDBusPendingCall(QDBusPendingCallPrivate *dd)
: d(dd)
{
+ if (dd) {
+ bool r = dd->ref.deref();
+ Q_ASSERT(r);
+ Q_UNUSED(r);
+ }
}
/*!
@@ -469,6 +474,7 @@ QDBusPendingCall QDBusPendingCall::fromCompletedCall(const QDBusMessage &msg)
msg.type() == QDBusMessage::ReplyMessage) {
d = new QDBusPendingCallPrivate(QDBusMessage(), 0);
d->replyMessage = msg;
+ d->ref.store(1);
}
return QDBusPendingCall(d);