Android: Reserve space for the QVarLengthArray, so we can use append

When the QVarLengthArray was initialized with a size then append would
add to the end of that. Therefore we need to use reserve to get the
desired effect.

Task-number: QTBUG-64905
Change-Id: Ia1ebeb26cd31bc5e92bd7f81079506a266b845bf
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
bb10
Andy Shaw 2017-12-05 13:45:13 +01:00 committed by Jan Arve Sæther
parent 81a88639ac
commit 87efdd8c7f
1 changed files with 2 additions and 1 deletions

View File

@ -106,7 +106,8 @@ namespace QtAndroidAccessibility
QAccessibleInterface *iface = interfaceFromId(objectId);
if (iface && iface->isValid()) {
const int childCount = iface->childCount();
QVarLengthArray<jint, 8> ifaceIdArray(childCount);
QVarLengthArray<jint, 8> ifaceIdArray;
ifaceIdArray.reserve(childCount);
for (int i = 0; i < childCount; ++i) {
QAccessibleInterface *child = iface->child(i);
if (child && child->isValid())