diff options
author | culler <culler> | 2023-11-07 14:37:22 (GMT) |
---|---|---|
committer | culler <culler> | 2023-11-07 14:37:22 (GMT) |
commit | 9bda6a9690126bd05e958983768caf99b11becb3 (patch) | |
tree | 6e08b0079fb7fc64fc7c5a1dffeb694becacfb24 /tests/menu.test | |
parent | f11fc58cf97c1045cee2687f159bd2ca54d891a6 (diff) | |
parent | 7515e96928296bec43aecdfb13b8110ab439329b (diff) | |
download | tk-9bda6a9690126bd05e958983768caf99b11becb3.zip tk-9bda6a9690126bd05e958983768caf99b11becb3.tar.gz tk-9bda6a9690126bd05e958983768caf99b11becb3.tar.bz2 |
Merge core-8-6-branch
Diffstat (limited to 'tests/menu.test')
-rw-r--r-- | tests/menu.test | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/menu.test b/tests/menu.test index 078604a..d207269 100644 --- a/tests/menu.test +++ b/tests/menu.test @@ -14,6 +14,8 @@ imageInit # find the earth.gif file for use in these tests (tests 2.*) set earthPhotoFile [file join [file dirname [info script]] earth.gif] testConstraint hasEarthPhoto [file exists $earthPhotoFile] +testConstraint pressbutton [llength [info commands pressbutton]] +testConstraint movemouse [llength [info commands movemouse]] test menu-1.1 {Tk_MenuCmd procedure} -body { menu @@ -4278,6 +4280,38 @@ test menu-40.14 {identifiers - reserved word} -setup { destroy .m } -result {2} +test menu-40.1 {Use-after-free if menu destroyed while posted - bug 09a11fb1228f} -setup { +} -constraints {pressbutton} -body { + set done false + event generate {} <Motion> -x 100 -y 100 + toplevel .t + menu .t.m + .t.m add command -command {puts Marco} -label Marco + .t.m add command -command {puts Polo} -label Polo + after 1000 {.t.m post 500 500} + after 2000 {destroy .t} + after 2500 {pressbutton 530 510} + after 3000 {set done true} + tkwait variable done +} + +test menu-40.2 {Use-after-free if menu destroyed while posted - bug 09a11fb1228f} -setup { +} -constraints {movemouse} -body { + set done false + event generate {} <Motion> -x 100 -y 100 + toplevel .t + menu .t.m + .t.m add command -command {puts Marco} -label Marco + .t.m add command -command {puts Polo} -label Polo + after 1000 {.t.m post 500 500} + after 2000 {movemouse 530 510} + after 3000 {destroy .t} + after 3500 {movemouse 530 530} + after 4000 pressbutton 530 530 + after 4500 {set done true} + tkwait variable done + pressbutton 530 510 +} # cleanup imageFinish |