Subject: Fixed [011706ec42] - tk::ButtonInvoke safety bug

From: fvogel <[email-masked]>
Date: Fri, 29 Apr 2016 19:07:53 +0000

---
 library/button.tcl | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/library/button.tcl b/library/button.tcl
index b2bafb2..061069a 100644
--- a/library/button.tcl
+++ b/library/button.tcl
@@ -597,14 +597,16 @@ proc ::tk::ButtonUp w {
 # w -		The name of the widget.
 
 proc ::tk::ButtonInvoke w {
-    if {[$w cget -state] ne "disabled"} {
+    if {[winfo exists $w] && [$w cget -state] ne "disabled"} {
 	set oldRelief [$w cget -relief]
 	set oldState [$w cget -state]
 	$w configure -state active -relief sunken
 	update idletasks
 	after 100
-	$w configure -state $oldState -relief $oldRelief
-	uplevel #0 [list $w invoke]
+        if {[winfo exists $w]} {
+        	$w configure -state $oldState -relief $oldRelief
+        	uplevel #0 [list $w invoke]
+        }
     }
 }
 
-- 
cgit v0.12