summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2020-06-14 21:34:03 (GMT)
committerfvogel <fvogelnew1@free.fr>2020-06-14 21:34:03 (GMT)
commitc62fcfd3b5d1581983a0a9d23567012e2cc8df51 (patch)
tree9f459200cd35369c6e22a87fa584e2bd71832510 /tests
parent7d7b9fba7fb2d97d9aaaf36725c9993edfe3596a (diff)
downloadtk-c62fcfd3b5d1581983a0a9d23567012e2cc8df51.zip
tk-c62fcfd3b5d1581983a0a9d23567012e2cc8df51.tar.gz
tk-c62fcfd3b5d1581983a0a9d23567012e2cc8df51.tar.bz2
Fix [40e4bf6198]: Entry: double free when textvariable set in validatecommand script
Diffstat (limited to 'tests')
-rw-r--r--tests/entry.test20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/entry.test b/tests/entry.test
index 3c80e07..c7fda8a 100644
--- a/tests/entry.test
+++ b/tests/entry.test
@@ -3384,6 +3384,26 @@ test entry-19.20 {entry widget validation} -setup {
} -cleanup {
destroy .e
} -result {all testdata mydata {.e -1 -1 testdata mydata {} all forced}}
+
+## This leaves validate alone because we trigger validation through the
+## textvar (a write trace), and the write during validation triggers
+## nothing (by definition of avoiding loops on var traces). This is
+## one of those "dangerous" conditions where the user will have a
+## different value in the entry widget shown as is in the textvar.
+test entry-19.21 {entry widget validation - bug 40e4bf6198} -setup {
+ unset -nocomplain ::e ::vVals
+} -body {
+ entry .e -validate key \
+ -validatecommand [list doval2 %W %d %i %P %s %S %v %V] \
+ -textvariable ::e
+ pack .e
+ set ::e origdata
+ .e insert 0 A
+ list [.e cget -validate] [.e get] $::e $::vVals
+} -cleanup {
+ destroy .e
+} -result {none origdata mydata {.e 1 0 Aorigdata origdata A key key}}
+
##
## End validation tests
##