diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2012-09-05 20:42:28 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-07 12:03:53 +0200 |
commit | e28a957035878abc5e7cccc9d16ffe0fcad842a2 (patch) | |
tree | 53e698bf74a52f360168bb2ffe1da8e746a51064 /src/gui | |
parent | 59774b5d649b6195ca9bc20ffb58479af9666478 (diff) |
Fix crash when QTextLayout::setAdditionalFormats is called with ranges with negative length
That can be reproduced in Qt Creator when deleting code.
Task-number: QTBUG-27140
Change-Id: Ida7177612653f10e5d866bf9a422c71c632f4eb3
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/text/qtextengine.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 448907b4fe..a07c562aca 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2723,8 +2723,10 @@ void QTextEngine::resolveAdditionalFormats() const QVarLengthArray<int, 64> addFormatSortedByStart; addFormatSortedByStart.reserve(specialData->addFormats.count()); - for (int i = 0; i < specialData->addFormats.count(); ++i) - addFormatSortedByStart.append(i); + for (int i = 0; i < specialData->addFormats.count(); ++i) { + if (specialData->addFormats.at(i).length >= 0) + addFormatSortedByStart.append(i); + } QVarLengthArray<int, 64> addFormatSortedByEnd = addFormatSortedByStart; qSort(addFormatSortedByStart.begin(), addFormatSortedByStart.end(), FormatRangeComparatorByStart(specialData->addFormats)); |