Avoiding crash when insert preEditString

We will insert an preEditString by QInputMethodEvent
See:
Task-number: QTCREATORBUG-5633
Task-number: QTCREATORBUG-6082

Change-Id: I8cfc7ab2543455dfdff8ec3df983d384513453e0
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
bb10
Yuchen Deng 2011-12-31 19:26:45 +08:00 committed by Qt by Nokia
parent b3ce4470ae
commit 0277f14f48
1 changed files with 2 additions and 0 deletions

View File

@ -495,6 +495,8 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
break;
}
newPosition = blockIt.position() + line.textStart() + line.textLength();
if (newPosition >= priv->length())
newPosition = priv->length() - 1;
if (line.lineNumber() < layout->lineCount() - 1) {
const QString text = blockIt.text();
// ###### this relies on spaces being the cause for linebreaks.