Tk Source Code

Artifact [a288653d]
Login

Artifact a288653d56b6caa4ce0c07744a786408b0a1ea9c:

Attachment "text-unmapped-2.patch" to ticket [ff8a1e55] added by danckaert 2015-12-07 14:27:30. (unpublished)
diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c
index 6defc6b..af3bf4d 100644
--- a/generic/tkTextDisp.c
+++ b/generic/tkTextDisp.c
@@ -660,17 +660,8 @@ TkTextCreateDInfo(
     dInfoPtr->metricEpoch = -1;
     dInfoPtr->metricIndex.textPtr = NULL;
     dInfoPtr->metricIndex.linePtr = NULL;
-
-    /*
-     * Add a refCount for each of the idle call-backs.
-     */
-
-    textPtr->refCount++;
-    dInfoPtr->lineUpdateTimer = Tcl_CreateTimerHandler(0,
-	    AsyncUpdateLineMetrics, textPtr);
-    textPtr->refCount++;
-    dInfoPtr->scrollbarTimer = Tcl_CreateTimerHandler(200,
-	    AsyncUpdateYScrollbar, textPtr);
+    dInfoPtr->lineUpdateTimer = NULL;
+    dInfoPtr->scrollbarTimer = NULL;

     textPtr->dInfoPtr = dInfoPtr;
 }
@@ -2914,9 +2905,10 @@ AsyncUpdateLineMetrics(

     dInfoPtr->lineUpdateTimer = NULL;

-    if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)) {
+    if ((textPtr->tkwin == NULL) || (textPtr->flags & DESTROYED)
+        || !Tk_IsMapped(textPtr->tkwin)) {
 	/*
-	 * The widget has been deleted. Don't do anything.
+	 * The widget has been deleted, or is not mapped. Don't do anything.
 	 */

 	if (--textPtr->refCount == 0) {