summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2017-09-12 15:44:00 (GMT)
committerdgp <dgp@users.sourceforge.net>2017-09-12 15:44:00 (GMT)
commit3776406b3c44c21f00b87384f81e559047f3a4fe (patch)
tree6ddacf0f390dfa8414e6f23532d6d7ca48235628 /generic
parent0c7e022b49b03f12c730da8b08d31969b09f28c8 (diff)
downloadtcl-3776406b3c44c21f00b87384f81e559047f3a4fe.zip
tcl-3776406b3c44c21f00b87384f81e559047f3a4fe.tar.gz
tcl-3776406b3c44c21f00b87384f81e559047f3a4fe.tar.bz2
Make sure ListObjReplace invalidates outdated intreps.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclListObj.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index fc253cc..f60329d 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -1127,10 +1127,15 @@ Tcl_ListObjReplace(
listRepPtr->elemCount = numRequired;
/*
- * Invalidate and free any old string representation since it no longer
- * reflects the list's internal representation.
+ * Invalidate and free any old representations that may not agree
+ * with the revised list's internal representation.
*/
+ listRepPtr->refCount++;
+ TclFreeIntRep(listPtr);
+ ListSetIntRep(listPtr, listRepPtr);
+ listRepPtr->refCount--;
+
TclInvalidateStringRep(listPtr);
return TCL_OK;
}