Merge pull request #665 from SamWhited/fix_crash

Fix deadlock in SetText
This commit is contained in:
rivo 2021-10-29 16:29:23 +02:00 committed by GitHub
commit a4acb08f51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -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
// contained text will be removed.
func (t *TextView) SetText(text string) *TextView {
t.Lock()
defer t.Unlock()
batch := t.BatchWriter()
defer batch.Close()
t.clear()
fmt.Fprint(t, text)
batch.Clear()
fmt.Fprint(batch, text)
return t
}