summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfvogel <fvogelnew1@free.fr>2023-05-25 06:15:41 (GMT)
committerfvogel <fvogelnew1@free.fr>2023-05-25 06:15:41 (GMT)
commit26d7d05357fd75491a39ab243619f20a0b06eca2 (patch)
treeda43e0adbad0107a85588570221f6aa934078096
parent847c110786d9f8cd396aa1b50d8d0bd494ecc186 (diff)
parentf5772f4bd64c0b956fbbb6673152b8dd7b4287f2 (diff)
downloadtk-26d7d05357fd75491a39ab243619f20a0b06eca2.zip
tk-26d7d05357fd75491a39ab243619f20a0b06eca2.tar.gz
tk-26d7d05357fd75491a39ab243619f20a0b06eca2.tar.bz2
Fix [7447ed20ec]: Color picker failure - tk::RestoreFocusGrab does not take into account the possibility of a failing grab.
-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}
}
}
}