From 173f7cf4cfa6289eab436d64654e37090f2616f3 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Mon, 8 Feb 2016 15:52:53 +0000 Subject: =?UTF-8?q?(cherry-pick):=20Fix=20[06c14339060ba9ae]:=20Text=20wid?= =?UTF-8?q?get=20crash=20during=20delete.=20Thanks=20to=20Fran=C3=A7ois=20?= =?UTF-8?q?Vogel=20for=20the=20implementation=20and=20Brian=20Griffin=20fo?= =?UTF-8?q?r=20all=20his=20help=20getting=20this=20figured=20out.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- generic/tkTextDisp.c | 8 +++----- tests/textDisp.test | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 10f6414..91642f9 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -4683,6 +4683,9 @@ TextChanged( */ lastPtr = FindDLine(textPtr, dInfoPtr->dLinePtr, &rounded); + while ((lastPtr != NULL) && (TkTextIndexCmp(&lastPtr->index, &rounded) < 0)) { + lastPtr = lastPtr->nextPtr; + } /* * At least one display line is supposed to change. This makes the @@ -4699,11 +4702,6 @@ TextChanged( } } - while ((lastPtr != NULL) - && (lastPtr->index.linePtr == index2Ptr->linePtr)) { - lastPtr = lastPtr->nextPtr; - } - /* * Delete all the DLines from firstPtr up to but not including lastPtr. */ diff --git a/tests/textDisp.test b/tests/textDisp.test index 6f26457..532caf4 100644 --- a/tests/textDisp.test +++ b/tests/textDisp.test @@ -1191,8 +1191,7 @@ test textDisp-8.12 {TkTextChanged, moving the insert cursor redraws only past an # because during (b) findDLine cannot return the display line the # cursor is in since this display line was just unlinked in (a). } {{8.0 9.0} {8.0 12.0} {8.0 12.0} {3.0 8.0} {2.0 3.0}} - -test textDisp-8.13 {TkTextChanged, [06c1433906]} { +test textDisp-8.13 {TkTextChanged, used to crash, see [06c1433906]} { .t delete 1.0 end .t insert 1.0 \nLine1\nLine2\n update -- cgit v0.12