Subject: Hopefully a better fix for [06c1433906] - Text widget crash

From: fvogel <[email-masked]>
Date: Sun, 7 Feb 2016 13:29:51 +0000

---
 generic/tkTextDisp.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 10f6414..fe69f28 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -4683,6 +4683,9 @@ TextChanged(
          */
 
         lastPtr = FindDLine(textPtr, dInfoPtr->dLinePtr, &rounded);
+        if ((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.
      */
-- 
cgit v0.12