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>
This commit is contained in:
Alberto Mardegan 2011-11-11 12:10:22 +01:00 committed by Qt by Nokia
parent 280f8829b6
commit 45d3702295

View File

@ -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;
}