diff options
author | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2011-05-18 16:20:38 (GMT) |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@nokia.com> | 2011-06-10 09:36:59 (GMT) |
commit | da9b2156015a946122eacc64437d214d1e184f35 (patch) | |
tree | 76c5c4d19fc8e1c8432c81d065488f523a59afaf /src/gui/accessible | |
parent | b606ccbc19cac720bc50a44b2f1195d53f6691e2 (diff) | |
download | Qt-da9b2156015a946122eacc64437d214d1e184f35.zip Qt-da9b2156015a946122eacc64437d214d1e184f35.tar.gz Qt-da9b2156015a946122eacc64437d214d1e184f35.tar.bz2 |
When asking for relations, don't crash on children that don't return an interface.
Reviewed-by: Jan-Arve
Diffstat (limited to 'src/gui/accessible')
-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) { |