From c130191cfa0f21c3ab4ac1092745bc5c06a42e7a Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 22 May 2016 19:56:27 +0000 Subject: Fixed [109865fa01] - ttk::menubutton has an unprotected winfo --- library/ttk/menubutton.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/ttk/menubutton.tcl b/library/ttk/menubutton.tcl index 093bb02..2be064c 100644 --- a/library/ttk/menubutton.tcl +++ b/library/ttk/menubutton.tcl @@ -57,7 +57,7 @@ if {[tk windowingsystem] eq "x11"} { bind TMenubutton \ { %W state pressed ; ttk::menubutton::Popdown %W } bind TMenubutton \ - { %W state !pressed } + { if {[winfo exists %W]} { %W state !pressed } } } # PostPosition -- -- cgit v0.12 From a129a2159a084a7ead331d54273f5cf2a3a7a961 Mon Sep 17 00:00:00 2001 From: fvogel Date: Sun, 22 May 2016 20:55:05 +0000 Subject: Added test checkbutton-1.7 to guard against regressions regarding [109865fa01] --- tests/ttk/checkbutton.test | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 destroy_button + pack .top.mb + focus -force .top.mb + update + event generate .top.mb <1> + event generate .top.mb + update ; # shall not trigger error invalid command name ".top.b" +} -result {} + tcltest::cleanupTests -- cgit v0.12