- upstream fix for QTextCursor regression (QTBUG-15857, kde#249373)

This commit is contained in:
Rex Dieter 2011-01-26 07:46:41 -06:00
parent 160e3905f0
commit 5a3b34906e
2 changed files with 54 additions and 3 deletions

View File

@ -0,0 +1,44 @@
From 34c297faca93e1286573b2a01127e4e7af00aff2 Mon Sep 17 00:00:00 2001
From: Jiang Jiang <jiang.jiang@nokia.com>
Date: Mon, 24 Jan 2011 19:09:38 +0100
Subject: [PATCH] Fix cursor position adjustment when removing strings
Commit 0ba1b4d0 introduced a regression to QTextDocument: it postponed
cursor position adjustment until the move operation is done, but
contentsChanged will be triggered by finishEdit() in this move
operation, thus cursor positions in this signal handler will be in
inconsistent states (normally we should first update cursor position
then trigger contentsChanged). In this case we should also postpone
finishEdit() handling after cursor positions have been adjusted, then
the states expose to applications will be consistent.
Task-number: QTBUG-15857
Reviewed-by: Eskil
---
src/gui/text/qtextdocument_p.cpp | 4 +++-
tests/auto/qtextcursor/tst_qtextcursor.cpp | 28 ++++++++++++++++++++++++++++
2 files changed, 31 insertions(+), 1 deletions(-)
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index 498a432..2172f74 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -663,7 +663,8 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
Q_ASSERT(blocks.length() == fragments.length());
- finishEdit();
+ if (!blockCursorAdjustment)
+ finishEdit();
}
void QTextDocumentPrivate::remove(int pos, int length, QTextUndoCommand::Operation op)
@@ -678,6 +679,7 @@ void QTextDocumentPrivate::remove(int pos, int length, QTextUndoCommand::Operati
curs->changed = true;
}
}
+ finishEdit();
}
void QTextDocumentPrivate::setCharFormat(int pos, int length, const QTextCharFormat &newFormat, FormatChangeMode mode)

13
qt.spec
View File

@ -18,7 +18,7 @@ Summary: Qt toolkit
Name: qt
Epoch: 1
Version: 4.7.1
Release: 10%{?dist}
Release: 11%{?dist}
# See LGPL_EXCEPTIONS.txt, LICENSE.GPL3, respectively, for exception details
License: (LGPLv2 with exceptions or GPLv3 with exceptions) and ASL 2.0 and BSD and FTL and MIT
@ -98,9 +98,12 @@ Patch100: qt-everywhere-opensource-src-4.7.1-ml_IN-bz528303.patch
# fix QTextCursor crash in Lokalize and Psi (QTBUG-15857, kde#249373, #660028)
# http://qt.gitorious.org/qt/qt/commit/6ae84f1183e91c910ca92a55e37f8254ace805c0
Patch101: qt-everywhere-opensource-src-4.7.1-qtextcursor-crash.patch
# followup for regressions
# http://qt.gitorious.org/qt/qt/commit/34c297faca93e1286573b2a01127e4e7af00aff2.patch
Patch102: qt-everywhere-opensource-4.7.1-QTBUG-15857-2.patch
# qsortfilterproxymodel merge, http://qt.gitorious.org/qt/qt/merge_requests/934
Patch102: qt-everywhere-opensource-src-4.7.1-qsortfilterproxymodel_merge934.patch
Patch103: qt-everywhere-opensource-src-4.7.1-qsortfilterproxymodel_merge934.patch
# kde-qt git patches
Patch202: 0002-This-patch-makes-override-redirect-windows-popup-men.patch
@ -471,7 +474,8 @@ Qt libraries used for drawing widgets and OpenGL items.
# upstream patches
%patch100 -p1 -b .ml_IN-rendering
%patch101 -p1 -b .qtextcursor-crash
%patch102 -p1 -b .qsortfilterproxymodel_merge934
%patch102 -p1 -b .QTBUG-15857-2
%patch103 -p1 -b .qsortfilterproxymodel_merge934
# kde-qt branch
%if 0%{?kde_qt}
@ -1153,6 +1157,9 @@ fi
%changelog
* Wed Jan 26 2011 Rex Dieter <rdieter@fedoraproject.org> 4.7.1-11
- upstream fix for QTextCursor regression (QTBUG-15857, kde#249373)
* Tue Jan 25 2011 Rex Dieter <rdieter@fedoraproject.org> 4.7.1-10
- -config subpkg
- qt-x11 pulls in phonon (#672088)