summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2023-05-25 06:15:52 (GMT)
committerfvogel <fvogelnew1@free.fr>2023-05-25 06:15:52 (GMT)
commitf24c0ef50f2464d0c046e3bdbd57821dadecb420 (patch)
tree9842237fa288fed2a3effa88d20a3c94f4d6feb1 /library
parent7556e80482746301fe930e61fe66888c2c74f70d (diff)
parent26d7d05357fd75491a39ab243619f20a0b06eca2 (diff)
downloadtk-f24c0ef50f2464d0c046e3bdbd57821dadecb420.zip
tk-f24c0ef50f2464d0c046e3bdbd57821dadecb420.tar.gz
tk-f24c0ef50f2464d0c046e3bdbd57821dadecb420.tar.bz2
Fix [7447ed20ec]: Color picker failure - tk::RestoreFocusGrab does not take into account the possibility of a failing grab.
Diffstat (limited to 'library')
-rw-r--r--library/tk.tcl7
1 files changed, 5 insertions, 2 deletions
diff --git a/library/tk.tcl b/library/tk.tcl
index 7f3ede3..a6dc37c 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -186,10 +186,13 @@ proc ::tk::RestoreFocusGrab {grab focus {destroy destroy}} {
}
}
if {[winfo exists $oldGrab] && [winfo ismapped $oldGrab]} {
+ # The "grab" command will fail if another application
+ # already holds the grab on a window with the same name.
+ # So catch it. See [7447ed20ec] for an example.
if {$oldStatus eq "global"} {
- grab -global $oldGrab
+ catch {grab -global $oldGrab}
} else {
- grab $oldGrab
+ catch {grab $oldGrab}
}
}
}