diff options
-rw-r--r-- | library/tk.tcl | 7 |
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} } } } |