diff mbox series

gitk: check main window visibility before waiting for it to show

Message ID pull.944.git.git.1610234771966.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series gitk: check main window visibility before waiting for it to show | expand

Commit Message

Tobias Pietzsch Jan. 9, 2021, 11:26 p.m. UTC
From: Tobias Pietzsch <pietzsch@mycroft.speedport.ip>

If the main window is already visible when gitk waits for it to
become visible, gitk hangs forever.
This commit adds a check whether the window is already visible.
See https://wiki.tcl-lang.org/page/tkwait+visibility

Signed-off-by: Tobias Pietzsch <pietzsch@mycroft.speedport.ip>
---
    gitk: check main window visibility before waiting for it to show
    
    If the main window is already visible when gitk waits for it to become
    visible, gitk hangs forever.
    
    This commit adds a check whether the window is already visible. See
    https://wiki.tcl-lang.org/page/tkwait+visibility
    
    The symptom of the for-ever waiting is that gitk shows just an empty
    window, like this: https://tinyurl.com/yxr5qlf6 It happens (to me) on
    macOS 11.1 with git-gui installed via homebrew. It doesn't happen on
    macOS 10.14.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-944%2Ftpietzsch%2Fmaster-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-944/tpietzsch/master-v1
Pull-Request: https://github.com/git/git/pull/944

 gitk-git/gitk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 72c4083ddf91b489b7b7b812df67ee8842177d98

Comments

Beat Bolli Jan. 10, 2021, 10:23 p.m. UTC | #1
On 10.01.21 00:26, Tobias Pietzsch via GitGitGadget wrote:
> From: Tobias Pietzsch <pietzsch@mycroft.speedport.ip>
>
> If the main window is already visible when gitk waits for it to
> become visible, gitk hangs forever.
> This commit adds a check whether the window is already visible.
> See https://wiki.tcl-lang.org/page/tkwait+visibility
>
> Signed-off-by: Tobias Pietzsch <pietzsch@mycroft.speedport.ip>
> ---
>     gitk: check main window visibility before waiting for it to show
>
>     If the main window is already visible when gitk waits for it to become
>     visible, gitk hangs forever.
>
>     This commit adds a check whether the window is already visible. See
>     https://wiki.tcl-lang.org/page/tkwait+visibility
>
>     The symptom of the for-ever waiting is that gitk shows just an empty
>     window, like this: https://tinyurl.com/yxr5qlf6 It happens (to me) on
>     macOS 11.1 with git-gui installed via homebrew. It doesn't happen on
>     macOS 10.14.

Thanks, this also occurred on my macOS 10.14.6 just an hour ago after a
recent brew upgrade, and the patch makes gitk usable again.

Cheers, Beat
diff mbox series

Patch

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 23d9dd1fe0d..cd02b4d50fc 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -12658,7 +12658,7 @@  catch {
     wm iconphoto . -default gitlogo gitlogo32
 }
 # wait for the window to become visible
-tkwait visibility .
+if {![winfo viewable .]} {tkwait visibility .}
 set_window_title
 update
 readrefs