qt5base-lts/tests/auto
Eskil Abrahamsen Blomfeldt 27bc4c4ce5 QPlainTextEdit: Fix crash on complex undo w/full width selection
Say you have a document of two blocks of text.

When you select a block of text in the document and then replace this
with a new empty block (by pressing enter) and then subsequently
undo this action, the following three steps are performed as a
chain of undo commands:

1. Remove the empty block at the beginning of the document
2. Insert a new empty block at the beginning of the document
3. Insert the text back into the first block

Since a block is removed and inserted in the same go, both blocks
require a relayout, since the accumulated change spans both blocks.
However, in QPlainTextDocumentLayout we would only look at the max
of either removed chars or added chars. This would match the text
length of the first block at this point, so we would only relayout
that block. However, since we are also removing characters, the
actual accumulated change to the document is larger. We should
relayout any block touched by the sum of the added and removed
character counts.

Missing this, the paint event would later query
block.layout()->lineForTextPosition(0) which would give an invalid
line despite the fact that the block.length() > 0. This caused
a crash in the paint event when the full width selection was
turned on.

Note that the logic here was only recently updated to include the
removed characters at all in the logic, by the SHA1:
2983cb9531.

[ChangeLog][QPlainTextEdit] Fixed a crash when using full width
selections and issuing a complex undo command chain which removes
and inserts an empty block in one go.

Task-number: QTBUG-36415
Change-Id: Iafe8a69e455e0c713a48714f10f0cace69c84f51
Reviewed-by: Axel Rasmussen <axel.rasmussen1@gmail.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-09-30 10:21:39 +02:00
..
android Android: Add some ci usage features to Android testrunner 2014-04-09 10:46:40 +02:00
bic/data test: Add 5.1.0 bic data for linux-gcc-ia32 2013-07-08 21:47:36 +02:00
cmake purge vestiges of opengl es 1 support 2014-04-04 19:32:21 +02:00
compilerwarnings/data Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
concurrent Add diagnostic output to tst_QtConcurrentIterateKernel. 2014-04-09 10:43:32 +02:00
corelib QSettings: Don't chop off trailing tabs that were actually part of a value. 2014-09-23 11:28:58 +02:00
dbus Fix dangling pointer dereferencing 2014-05-09 03:39:34 +02:00
gui Fix crash in QTextLayout::cursorToX 2014-09-02 14:18:08 +02:00
guiapplauncher Update the documentation after moving examples. 2011-07-05 21:19:08 +02:00
installed_cmake Add a unit test for testing Qt in its install location. 2013-07-02 23:08:54 +02:00
network QNAM: Fix previous HTTP upload CPU fix 2014-09-25 17:10:54 +02:00
opengl Merge remote-tracking branch 'origin/release' into stable 2014-05-01 13:08:42 +02:00
other QProcess: Handle spurious socket notifications for stdout and stderr 2014-06-12 17:54:11 +02:00
printsupport QPrinter - Expect failure of QPrinter page size test 2014-03-17 13:46:29 +01:00
shared iOS: Fix compilation of some basic tests 2014-01-17 11:04:43 +01:00
sql Use sched_yield instead of pthread_yield 2014-05-05 22:40:49 +02:00
testlib QNX: Fix tst_selftest 2014-05-16 10:20:34 +02:00
tools Correct grammar of missing Q_OBJECT macro warning. 2014-06-23 11:19:07 +02:00
widgets QPlainTextEdit: Fix crash on complex undo w/full width selection 2014-09-30 10:21:39 +02:00
xml Speed up tst_QXmlSimpleReader. 2014-05-08 16:06:11 +02:00
auto.pro iOS: Enable building of basic tests 2014-01-22 12:35:17 +01:00
network-settings.h network test settings: support newer FTP server versions 2013-08-28 12:45:34 +02:00
qtest-config.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
test.pl Whitespace cleanup: remove trailing whitespace 2013-03-16 20:22:50 +01:00