summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2009-10-06 12:26:58 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2009-10-06 12:28:16 (GMT)
commitd824af2348d11a7f364a1046a704268830f35f13 (patch)
treeb389987052ad7671bf1ea6f7601f1aefe7a16ec6 /src/gui
parent0d51611fa524091ddca3c6c11edb0eae8ffe3b02 (diff)
downloadQt-d824af2348d11a7f364a1046a704268830f35f13.zip
Qt-d824af2348d11a7f364a1046a704268830f35f13.tar.gz
Qt-d824af2348d11a7f364a1046a704268830f35f13.tar.bz2
Fix crash in QPlainTextEdit when using large fonts
When using very large fonts, sometimes the scrollbar of the QPlainTextEdit will allow you to do scroll down past the end of the document, in which case the currentBlock in hitTest() is inValid() which caused an assert in currentBlock.next(). Task-number: QT-938 Reviewed-by: mae
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/qplaintextedit.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index 5d13c36..2ed6cd7 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -519,6 +519,9 @@ QTextBlock QPlainTextEditControl::firstVisibleBlock() const
int QPlainTextEditControl::hitTest(const QPointF &point, Qt::HitTestAccuracy ) const {
int currentBlockNumber = topBlock;
QTextBlock currentBlock = document()->findBlockByNumber(currentBlockNumber);
+ if (!currentBlock.isValid())
+ return -1;
+
QPlainTextDocumentLayout *documentLayout = qobject_cast<QPlainTextDocumentLayout*>(document()->documentLayout());
Q_ASSERT(documentLayout);