summaryrefslogtreecommitdiffstats
path: root/library/tk.tcl
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2023-05-23 18:58:03 (GMT)
committerfvogel <fvogelnew1@free.fr>2023-05-23 18:58:03 (GMT)
commitf5772f4bd64c0b956fbbb6673152b8dd7b4287f2 (patch)
tree5a31255c0087764852d0fc5d1801d8d6eaf6f808 /library/tk.tcl
parentcfbfc56ab08376755eb01d9a30ab48af0fefe7cc (diff)
downloadtk-f5772f4bd64c0b956fbbb6673152b8dd7b4287f2.zip
tk-f5772f4bd64c0b956fbbb6673152b8dd7b4287f2.tar.gz
tk-f5772f4bd64c0b956fbbb6673152b8dd7b4287f2.tar.bz2
Fix [7447ed20ec]: Color picker failure - tk::RestoreFocusGrab does not take into account the possibility of a failing grab.
Diffstat (limited to 'library/tk.tcl')
-rw-r--r--library/tk.tcl7
1 files changed, 5 insertions, 2 deletions
diff --git a/library/tk.tcl b/library/tk.tcl
index e00f073..98d643c 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}
}
}
}