mirror of
https://github.com/jesseduffield/lazygit.git
synced 2026-08-28 18:24:17 -05:00
Close read and called stopCurrentTask with no lock, while NewTask's goroutine assigns it (and constructs the sync.Once it closes over) under waitingMutex. On shutdown Close runs while a render task spawned by the last layout is still starting, so the two raced on the field and the once (three DATA RACE blocks under -race, e.g. cherry_pick). Read stopCurrentTask once under waitingMutex and call the captured value instead of re-reading the field, which establishes the happens-before the once needs. This can't deadlock: no task holds waitingMutex across a blocking UI-thread hop, so Close can always take it, and a task wedged in such a hop is still bounded by the existing 3s timeout. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>