diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-06 11:16:19 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-06 11:16:19 +0300 |
| commit | aa9444a75c22e381e94ef4988d42e44af5c51016 (patch) | |
| tree | 8fadbb04f6a168e7cac972a7b7792198da5ccdb1 /internal/cli/command.go | |
| parent | 616beecc41b573503dad9f5bfd9f353c6f826a8a (diff) | |
fix: track all GUI goroutines with WaitGroup and ctx.Done() (Go Mistake #62)
Fire-and-forget goroutines in the tooltip setup, word-change handler, and
audio playback could write to freed Fyne widgets after the window was closed.
All four patterns are now fixed:
- setupTooltips() and the secondary-toolbar tooltip block: replaced
time.AfterFunc(500ms) with wg-tracked goroutines using select/ctx.Done().
- handleWordChange(): replaced time.AfterFunc(100ms) with the same pattern.
- onWindowClosed(): added wordChangeTimer.Stop() to prevent its AfterFunc
callback from firing after context cancellation.
- AudioPlayer: added ctx context.Context field + SetContext(); the
post-playback goroutine now guards fyne.Do with ctx.Err() == nil, and the
auto-play AfterFunc is replaced with a ctx-aware goroutine.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/cli/command.go')
0 files changed, 0 insertions, 0 deletions
