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>
This commit is contained in:
Frederik Gladhorn 2016-01-25 12:28:25 +01:00 committed by Simon Hausmann
parent 14ef6abd0b
commit 4c8cb329d4

View File

@ -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;