diff options
author | fvogel <fvogel@noemail.net> | 2016-05-25 19:36:21 (GMT) |
---|---|---|
committer | fvogel <fvogel@noemail.net> | 2016-05-25 19:36:21 (GMT) |
commit | 425a61845fa7f0bf581991d86a894848b6a73ffd (patch) | |
tree | 39ad7f79f0681e3b934d7595415c6db968618e2c | |
parent | d632f3291a382f5b7f35c2078cceddbb3625bcfa (diff) | |
parent | f7ea9a9691574a84c77bb596181e0fe013040108 (diff) | |
download | tk-425a61845fa7f0bf581991d86a894848b6a73ffd.zip tk-425a61845fa7f0bf581991d86a894848b6a73ffd.tar.gz tk-425a61845fa7f0bf581991d86a894848b6a73ffd.tar.bz2 |
Fixed [109865fa01] - ttk::menubutton unsafe wrt widget destruction
FossilOrigin-Name: 9124c4d887370dea34b8d4a9f22e8ada21f43132
-rw-r--r-- | library/ttk/menubutton.tcl | 2 | ||||
-rw-r--r-- | tests/ttk/checkbutton.test | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/library/ttk/menubutton.tcl b/library/ttk/menubutton.tcl index ad57020..648cdee 100644 --- a/library/ttk/menubutton.tcl +++ b/library/ttk/menubutton.tcl @@ -57,7 +57,7 @@ if {[tk windowingsystem] eq "x11"} { bind TMenubutton <ButtonPress-1> \ { %W state pressed ; ttk::menubutton::Popdown %W } bind TMenubutton <ButtonRelease-1> \ - { %W state !pressed } + { if {[winfo exists %W]} { %W state !pressed } } } # PostPosition -- diff --git a/tests/ttk/checkbutton.test b/tests/ttk/checkbutton.test index e18ff32..6b79287 100644 --- a/tests/ttk/checkbutton.test +++ b/tests/ttk/checkbutton.test @@ -45,4 +45,20 @@ test checkbutton-1.6 "Checkbutton default variable" -body { lappend result [info exists .cb] [set .cb] [.cb state] } -result [list .cb 0 alternate 1 on selected 1 off {}] +# Bug [109865fa01] +test checkbutton-1.7 "Button destroyed by click" -body { + proc destroy_button {} { + destroy .top + } + toplevel .top + ttk::menubutton .top.mb -text Button -style TLabel + bind .top.mb <ButtonRelease-1> destroy_button + pack .top.mb + focus -force .top.mb + update + event generate .top.mb <1> + event generate .top.mb <ButtonRelease-1> + update ; # shall not trigger error invalid command name ".top.b" +} -result {} + tcltest::cleanupTests |