Skip to content

Commit

Permalink
fix(cellbuf): ensure Screen.Resize and Screen.MoveTo are thread-safe
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Dec 10, 2024
1 parent 8f8e060 commit df74b90
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cellbuf/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -1165,9 +1165,10 @@ func (s *Screen) Resize(width, height int) bool {
s.ClearInRect(Rect(0, height-1, width, oldh-height))
}

s.mu.Lock()
s.newbuf.Resize(width, height)

s.opts.Width, s.opts.Height = width, height
s.mu.Unlock()

return true
}
Expand All @@ -1178,7 +1179,9 @@ func (s *Screen) MoveTo(x, y int) bool {
if !s.Bounds().Contains(pos) {
return false
}
s.mu.Lock()
s.pos = pos
s.mu.Unlock()
return true
}

Expand Down

0 comments on commit df74b90

Please sign in to comment.