summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-04-15 10:12:34 +0200
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2009-04-15 10:17:13 +0200
commitb33ebce3de3efd98a45c8ca0a349f78aac09c875 (patch)
tree805f300733a23c73e603124f6510083ff8b579dd /src
parent6c4b9cb575292f5f81afc772d993c1a53eb96ea5 (diff)
downloadqt4-tools-b33ebce3de3efd98a45c8ca0a349f78aac09c875.tar.gz
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')
-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 4b2b2abe76..753ac575e5 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())