diff options
author | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2011-05-18 16:20:38 (GMT) |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2011-05-19 12:55:10 (GMT) |
commit | a816cb0d26ebcef54e9e61c72455509edf6c44b9 (patch) | |
tree | a0512567ce867849fb5494dbe3f5a096012c5ef3 | |
parent | 37c4cd4801106112b638ed9d2164b87bbc0a0d1e (diff) | |
download | Qt-a816cb0d26ebcef54e9e61c72455509edf6c44b9.zip Qt-a816cb0d26ebcef54e9e61c72455509edf6c44b9.tar.gz Qt-a816cb0d26ebcef54e9e61c72455509edf6c44b9.tar.bz2 |
When asking for relations, don't crash on children that don't return an interface.
Reviewed-by: Jan-Arve
-rw-r--r-- | src/gui/accessible/qaccessiblewidget.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/gui/accessible/qaccessiblewidget.cpp b/src/gui/accessible/qaccessiblewidget.cpp index 2b2cec0..52aab32 100644 --- a/src/gui/accessible/qaccessiblewidget.cpp +++ b/src/gui/accessible/qaccessiblewidget.cpp @@ -704,13 +704,16 @@ 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; - delete candidate; + if (candidate != pIface) + delete candidate; candidate = 0; } if (!candidate) { |