summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2010-12-06 12:07:36 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2010-12-06 14:04:59 (GMT)
commit6ae84f1183e91c910ca92a55e37f8254ace805c0 (patch)
tree6e2731b2a7b4f0af40b9e32215295745487f09c5
parent9327490ad51b737211c26cae53a095a8485e2dad (diff)
downloadQt-6ae84f1183e91c910ca92a55e37f8254ace805c0.zip
Qt-6ae84f1183e91c910ca92a55e37f8254ace805c0.tar.gz
Qt-6ae84f1183e91c910ca92a55e37f8254ace805c0.tar.bz2
Fix QTextEdit::selectAll crash from textChanged()
Doing selectAll() after the entire block of text has been removed will cause this crash, because we didn't check if the block we found is valid or not. Task-number: QTBUG-15857 Reviewed-by: Eskil
-rw-r--r--src/gui/text/qtextcursor.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 769ab2f..f73cc4b 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -363,6 +363,9 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
bool adjustX = true;
QTextBlock blockIt = block();
+ if (!blockIt.isValid())
+ return false;
+
if (op >= QTextCursor::Left && op <= QTextCursor::WordRight
&& blockIt.textDirection() == Qt::RightToLeft) {
if (op == QTextCursor::Left)