diff options
author | Alberto Mardegan <mardy@users.sourceforge.net> | 2011-11-11 12:10:22 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-16 18:16:26 +0100 |
commit | 45d37022956238273d1afcd7f2083c844987e933 (patch) | |
tree | 69951985b3c3cd64947e3fbec94c41f2415ff841 | |
parent | 280f8829b6eeaafe8b22a33c996a088676b1cc99 (diff) |
Don't directly access QList contents
The existing code doesn't work on 64bit machines. We must first convert
the list into a QVector, which guarantees that elements are laid out
correctly as an array.
Merge-request: 1467
Reviewed-by: thiago
(cherry picked from commit 00020eed3fa948f69cfa776e92121edec6f975cc)
Change-Id: I00020eed3fa948f69cfa776e92121edec6f975cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
-rw-r--r-- | src/dbus/qdbuspendingcall.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dbus/qdbuspendingcall.cpp b/src/dbus/qdbuspendingcall.cpp index ea847421d0..2278db4394 100644 --- a/src/dbus/qdbuspendingcall.cpp +++ b/src/dbus/qdbuspendingcall.cpp @@ -180,9 +180,12 @@ bool QDBusPendingCallPrivate::setReplyCallback(QObject *target, const char *memb if (metaTypes.at(count) == QDBusMetaTypeId::message) --count; - // QList<int> is actually a vector - // kids, don't try this at home - setMetaTypes(count, count ? &metaTypes.at(1) : 0); + if (count == 0) { + setMetaTypes(count, 0); + } else { + QVector<int> types = QVector<int>::fromList(metaTypes); + setMetaTypes(count, types.constData() + 1); + } return true; } |