Merge pull request #665 from SamWhited/fix_crash

Fix deadlock in SetText
pull/666/head
rivo 3 years ago committed by GitHub
commit a4acb08f51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

Loading…
Cancel
Save