From d0d3379128904b63c732265d6972fefa807a9cd5 Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Fri, 29 Oct 2021 07:27:24 -0400 Subject: [PATCH] Fix deadlock in SetText Signed-off-by: Sam Whited --- textview.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/textview.go b/textview.go index 68faf99..0f7018f 100644 --- a/textview.go +++ b/textview.go @@ -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 }