Skip to content

Commit

Permalink
Make sure we pass our mutex by reference
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Feb 27, 2021
1 parent 65cb46c commit 4e2643f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tea.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func WithoutCatchPanics() ProgramOption {
type Program struct {
initialModel Model

mtx sync.Mutex
mtx *sync.Mutex

output io.Writer // where to send output. this will usually be os.Stdout.
input io.Reader // this will usually be os.Stdin.
Expand Down Expand Up @@ -152,6 +152,7 @@ type hideCursorMsg struct{}
// NewProgram creates a new Program.
func NewProgram(model Model, opts ...ProgramOption) *Program {
p := &Program{
mtx: &sync.Mutex{},
initialModel: model,
output: os.Stdout,
input: os.Stdin,
Expand Down Expand Up @@ -221,7 +222,7 @@ func (p *Program) Start() error {
}()
}

p.renderer = newRenderer(p.output, &p.mtx)
p.renderer = newRenderer(p.output, p.mtx)

// Check if output is a TTY before entering raw mode, hiding the cursor and
// so on.
Expand Down

0 comments on commit 4e2643f

Please sign in to comment.