Avoid race on renderer.buf in flush vs. write
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Fix race by acquiring the mutex before accessing renderer.buf in flush. WARNING: DATA RACE Read at 0x00c0000ee0a0 by goroutine 11: bytes.(*Buffer).Len() /home/chlunde/opt/go/src/bytes/buffer.go:73 +0x64 github.com/charmbracelet/bubbletea.(*renderer).flush() /home/chlunde/src/bubbletea/renderer.go:91 +0x45 github.com/charmbracelet/bubbletea.(*renderer).listen() /home/chlunde/src/bubbletea/renderer.go:76 +0x185 Previous write at 0x00c0000ee0a0 by main goroutine: bytes.(*Buffer).Reset() /home/chlunde/opt/go/src/bytes/buffer.go:98 +0xf5 github.com/charmbracelet/bubbletea.(*renderer).write() /home/chlunde/src/bubbletea/renderer.go:195 +0x13c github.com/charmbracelet/bubbletea.(*Program).Start() /home/chlunde/src/bubbletea/tea.go:330 +0xbbb main.main() /home/chlunde/src/bubbletea/examples/spinner/main.go:27 +0x229 Fixes #54
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+3 added−3 removed
- other:+3 added−3 removed