forked from Mirrors/bubbletea
Mutex protect buffer access in standard renderer
This commit is contained in:
parent
ac28669943
commit
a72db29ae0
|
@ -88,6 +88,9 @@ func (r *standardRenderer) listen() {
|
|||
|
||||
// flush renders the buffer.
|
||||
func (r *standardRenderer) flush() {
|
||||
r.mtx.Lock()
|
||||
defer r.mtx.Unlock()
|
||||
|
||||
if r.buf.Len() == 0 || r.buf.String() == r.lastRender {
|
||||
// Nothing to do
|
||||
return
|
||||
|
@ -95,9 +98,6 @@ func (r *standardRenderer) flush() {
|
|||
|
||||
out := new(bytes.Buffer)
|
||||
|
||||
r.mtx.Lock()
|
||||
defer r.mtx.Unlock()
|
||||
|
||||
// Clear any lines we painted in the last render.
|
||||
if r.linesRendered > 0 {
|
||||
for i := r.linesRendered - 1; i > 0; i-- {
|
||||
|
|
Loading…
Reference in New Issue