fix(desktop): keep the tray responsive when the webview is wedged#3862
Merged
Conversation
The left-click handler set via systray.SetOnTapped runs synchronously inside the tray's Win32 wndProc. When showFromTray blocks — runtime.WindowShow can stall while the webview/main thread is wedged after sleep + a dropped network connection — wndProc never returns and the tray's message pump freezes: the icon stays in the tray (selectable via Win+B) but no click does anything. The menu items were already decoupled via goroutines; the tap handler was the last callback running on the message loop. Dispatch showFromTray on a goroutine so the pump is never blocked. Closes #3834
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After minimizing to the tray, then sleeping the machine and losing the network for a while, clicking the Reasonix tray icon does nothing — the icon is still there (selectable via Win+B) but no click responds (#3834).
Root cause
fyne.io/systraydispatches a left-click straight from its Win32 message loop:tappedLeftis ourSetOnTapped(func(){ a.showFromTray() }), which runsruntime.WindowShow. When the webview / main thread is wedged (a known post-sleep + dropped-connection state), that call blocks, sowndProcnever returns and the tray's message pump freezes — the icon stays registered with the shell (hence selectable) but stops processing any click.The tray menu items don't hit this: they're already decoupled onto goroutines (
for range item.ClickedCh). The left-tap handler was the last callback still running on the message loop.Fix
Dispatch
showFromTrayon a goroutine sowndProcreturns immediately and the pump never blocks — matching the menu-item pattern. A wedgedWindowShowthen leaks a short-lived goroutine at worst (it completes when the webview recovers) instead of freezing the whole tray.Test
No unit test — this is a threading fix on a third-party Win32 callback (the menu-item decoupling it mirrors is likewise untested). Verified
cd desktop && go build ./... && go vet ./....Closes #3834