Fix race condition with locking in SetText

Signed-off-by: Sam Whited <sam@samwhited.com>
pull/652/head
Sam Whited 3 years ago
parent 4385df9931
commit c0678d7aa9

@ -281,7 +281,10 @@ func (t *TextView) SetTextColor(color tcell.Color) *TextView {
// SetText sets the text of this text view to the provided string. Previously
// contained text will be removed.
func (t *TextView) SetText(text string) *TextView {
t.Clear()
t.Lock()
defer t.Unlock()
t.clear()
fmt.Fprint(t, text)
return t
}

Loading…
Cancel
Save