When asking for relations, don't crash on children that don't return an interface.

Reviewed-by: Jan-Arve
(cherry picked from commit a816cb0d26ebcef54e9e61c72455509edf6c44b9)

Change-Id: I8fed57eb0dfd5b67dee440b19c0ad5b9d7b3ae2d
Reviewed-on: http://codereview.qt.nokia.com/3020
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
This commit is contained in:
Frederik Gladhorn 2011-05-18 18:20:38 +02:00 committed by Qt by Nokia
parent 29a8761cd8
commit a3ce0eb6f1

View File

@ -704,12 +704,15 @@ int QAccessibleWidget::navigate(RelationFlag relation, int entry,
int sibCount = pIface->childCount();
QAccessibleInterface *candidate = 0;
for (int i = 0; i < sibCount && entry; ++i) {
pIface->navigate(Child, i+1, &candidate);
Q_ASSERT(candidate);
if (candidate->relationTo(0, this, 0) & Label)
const int childId = pIface->navigate(Child, i+1, &candidate);
Q_ASSERT(childId >= 0);
if (childId > 0)
candidate = pIface;
if (candidate->relationTo(childId, this, 0) & Label)
--entry;
if (!entry)
break;
if (candidate != pIface)
delete candidate;
candidate = 0;
}