diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2016-01-25 12:28:25 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-01-28 18:09:22 +0000 |
commit | 4c8cb329d458196105d73f08426c8f3b18d61ec7 (patch) | |
tree | 4d14807a9158eec80765f2b07db63571387be971 /src/plugins/platforms | |
parent | 14ef6abd0b8bb877edc0c479cd8a0067a4346c70 (diff) |
Accessibility OS X: Fix hang when editing password line edits
This fixes a regression when entering data in a password field.
The important part is to simply not call convertLineOffset for
single line text edits. The reason is that the function when dealing
with password fields gets an empty string back when calling textAt etc.
This is good since we don't want to leak passwords through a11y apis.
The problem with the functions returning empty strings is that we end up
in an infinite loop in convertLineOffset.
Task-number: QTBUG-49437
Change-Id: I76faa7e33e3ad5c3aeb5c75d8c4b93f1b8227bfc
Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index f554bbfe90..081bf927d9 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -336,9 +336,11 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of } else if ([attribute isEqualToString:NSAccessibilityInsertionPointLineNumberAttribute]) { if (QAccessibleTextInterface *text = iface->textInterface()) { - int line = -1; - int position = text->cursorPosition(); - convertLineOffset(text, &line, &position); + int line = 0; // true for all single line edits + if (iface->state().multiLine) { + int position = text->cursorPosition(); + convertLineOffset(text, &line, &position); + } return [NSNumber numberWithInt: line]; } return nil; |