Subject: Fix crashing test case, textDisp-8.13

From: dgp <[email-masked]>
Date: Fri, 5 Feb 2016 19:30:32 +0000

---
 generic/tkTextDisp.c | 5 +++++
 tests/textDisp.test  | 9 +++++++++
 2 files changed, 14 insertions(+)

diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 18b373f..f2e760b 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -4765,6 +4765,11 @@ 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 caba769..f5fbd3d 100644
--- a/tests/textDisp.test
+++ b/tests/textDisp.test
@@ -1192,6 +1192,15 @@ test textDisp-8.12 {TkTextChanged, moving the insert cursor redraws only past an
     # 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]} {
+    .t delete 1.0 end
+    .t insert 1.0 \nLine1\nLine2\n
+    update
+    .t insert 3.0 ""
+    .t delete 1.0 2.0
+    update idletasks
+} {}
+
 test textDisp-9.1 {TkTextRedrawTag} {
     .t configure -wrap char
     .t delete 1.0 end
-- 
cgit v0.12