Fix QtextLayout bug, needed for Calligra, backport from Qt 4.8.2 branch

This commit is contained in:
Manuel Tortosa 2012-04-13 00:00:08 +02:00
parent 990730fbca
commit e836a5e4c4
2 changed files with 40 additions and 3 deletions

View File

@ -6,7 +6,7 @@
pkgbase=qt
pkgname=('qt' 'qt-private-headers')
pkgver=4.8.1
pkgrel=1
pkgrel=2
arch=('i686' 'x86_64')
url='http://qt.nokia.com/'
license=('GPL3' 'LGPL')
@ -18,12 +18,13 @@ options=('!libtool')
_pkgfqn="qt-everywhere-opensource-src-${pkgver}"
source=("ftp://ftp.qt.nokia.com/qt/source/${_pkgfqn}.tar.gz"
'assistant.desktop' 'designer.desktop' 'linguist.desktop'
'qtconfig.desktop')
'qtconfig.desktop' 'fix-qtextlayout.diff')
md5sums=('7960ba8e18ca31f0c6e4895a312f92ff'
'fc211414130ab2764132e7370f8e5caa'
'85179f5e0437514f8639957e1d8baf62'
'f11852b97583610f3dbb669ebc3e21bc'
'6b771c8a81dd90b45e8a79afa0e5bbfd')
'6b771c8a81dd90b45e8a79afa0e5bbfd'
'b1ab0cca222178bbe2ee010f59ac0277')
# source PKGBUILD && _create-kdeqt-patch
_create-kdeqt-patch() {
@ -52,6 +53,9 @@ build() {
# sed -i -e 's/^.*kde-qt .*/ echo " kde-qt '${kdeqtver}'"/' $startdir/qt.install
# fi
msg "Applying fixes..."
patch -Np1 -i ${srcdir}/fix-qtextlayout.diff
export QT4DIR="${srcdir}"/${_pkgfqn}
export LD_LIBRARY_PATH=${QT4DIR}/lib:${LD_LIBRARY_PATH}

33
qt/fix-qtextlayout.diff Normal file
View File

@ -0,0 +1,33 @@
From cac12f4592477d99ef6fffaad40345bf85ef53b5 Mon Sep 17 00:00:00 2001
From: Jiang Jiang <jiang.jiang@nokia.com>
Date: Mon, 2 Apr 2012 12:32:05 +0200
Subject: [PATCH] Fix a crash in cursorToX() when new block is added
When an empty new block is being added, the layoutData->memory data
will be 0, thus QTextEngine::attributes() will return 0. We should
only access the attributes pointer when some text actually exist.
Task-number: QTBUG-24718
Change-Id: I9ce9f7b57bccf24099a02832ce30fb6cebfaad33
---
src/gui/text/qtextlayout.cpp | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index ee658d9..16f7150 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -2508,6 +2508,10 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const
int pos = *cursorPos;
int itm;
const HB_CharAttributes *attributes = eng->attributes();
+ if (!attributes) {
+ *cursorPos = 0;
+ return x.toReal();
+ }
while (pos < line.from + line.length && !attributes[pos].charStop)
pos++;
if (pos == line.from + (int)line.length) {
--
1.7.7.4