summaryrefslogtreecommitdiffstats
path: root/src/gui/accessible
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-04-15 08:12:34 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2009-04-15 08:17:13 (GMT)
commitb33ebce3de3efd98a45c8ca0a349f78aac09c875 (patch)
tree805f300733a23c73e603124f6510083ff8b579dd /src/gui/accessible
parent6c4b9cb575292f5f81afc772d993c1a53eb96ea5 (diff)
downloadQt-b33ebce3de3efd98a45c8ca0a349f78aac09c875.zip
Qt-b33ebce3de3efd98a45c8ca0a349f78aac09c875.tar.gz
Qt-b33ebce3de3efd98a45c8ca0a349f78aac09c875.tar.bz2
Don't crash or loop infinitely when we retrieving the accessible accel.
qt_accHotKey() was pretty buggy; it could both crash or spin forever in some cases. Task-number: 221731 Reviewed-by: alexis
Diffstat (limited to 'src/gui/accessible')
-rw-r--r--src/gui/accessible/qaccessiblewidget.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/gui/accessible/qaccessiblewidget.cpp b/src/gui/accessible/qaccessiblewidget.cpp
index 4b2b2ab..753ac57 100644
--- a/src/gui/accessible/qaccessiblewidget.cpp
+++ b/src/gui/accessible/qaccessiblewidget.cpp
@@ -131,9 +131,16 @@ QString Q_GUI_EXPORT qt_accHotKey(const QString &text)
int fa = 0;
QChar ac;
while ((fa = text.indexOf(QLatin1Char('&'), fa)) != -1) {
- if (fa == text.length() - 1 || text.at(fa+1) != QLatin1Char('&')) {
- ac = text.at(fa+1);
- break;
+ ++fa;
+ if (fa < text.length()) {
+ // ignore "&&"
+ if (text.at(fa) == QLatin1Char('&')) {
+ ++fa;
+ continue;
+ } else {
+ ac = text.at(fa);
+ break;
+ }
}
}
if (ac.isNull())