Contents of /trunk/qt4/patches/qt-4.8.1-fix-cursortox-crash.patch
Parent Directory | Revision Log
Revision 1771 -
(show annotations)
(download)
Wed May 9 07:58:18 2012 UTC (12 years, 4 months ago) by niro
File size: 1268 byte(s)
Wed May 9 07:58:18 2012 UTC (12 years, 4 months ago) by niro
File size: 1268 byte(s)
-added upstrean patches for qt-4.8.1
1 | Index: fix-cursortox-crash.patch |
2 | =================================================================== |
3 | --- fix-cursortox-crash.patch (revision 0) |
4 | +++ fix-cursortox-crash.patch (arbetskopia) |
5 | #commit cac12f4592477d99ef6fffaad40345bf85ef53b5 |
6 | #Author: Jiang Jiang <jiang.jiang@nokia.com> |
7 | #Date: Mon Apr 2 12:32:05 2012 +0200 |
8 | # |
9 | # Fix a crash in cursorToX() when new block is added |
10 | # |
11 | # When an empty new block is being added, the layoutData->memory data |
12 | # will be 0, thus QTextEngine::attributes() will return 0. We should |
13 | # only access the attributes pointer when some text actually exist. |
14 | # |
15 | # Task-number: QTBUG-24718 |
16 | # Change-Id: I9ce9f7b57bccf24099a02832ce30fb6cebfaad33 |
17 | # |
18 | diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp |
19 | index ee658d9..16f7150 100644 |
20 | --- a/src/gui/text/qtextlayout.cpp |
21 | +++ b/src/gui/text/qtextlayout.cpp |
22 | @@ -2508,6 +2508,10 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const |
23 | int pos = *cursorPos; |
24 | int itm; |
25 | const HB_CharAttributes *attributes = eng->attributes(); |
26 | + if (!attributes) { |
27 | + *cursorPos = 0; |
28 | + return x.toReal(); |
29 | + } |
30 | while (pos < line.from + line.length && !attributes[pos].charStop) |
31 | pos++; |
32 | if (pos == line.from + (int)line.length) { |