[PR #641] [CLOSED] Make TextView.Clear safe #1003

Closed
opened 2026-03-04 01:08:58 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/rivo/tview/pull/641
Author: @sachaos
Created: 9/9/2021
Status: Closed

Base: masterHead: master


📝 Commits (1)

📊 Changes

1 file changed (+2 additions, -0 deletions)

View changed files

📝 textview.go (+2 -0)

📄 Description

Fix https://github.com/rivo/tview/issues/636

I think the problem is TextView.Clear is not locking.
When we clear the TextView, the buffer will be nil.
So call Clear while drawing buffer, it will panic with that stack trace.

github.com/rivo/tview.(*TextView).Draw(0xc0000bc100, {0xa43700, 0xc000568000})
        /home/sam/go/pkg/mod/github.com/rivo/tview@v0.0.0-20210624165335-29d673af0ce2/textview.go:1017 +0xdf4

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/rivo/tview/pull/641 **Author:** [@sachaos](https://github.com/sachaos) **Created:** 9/9/2021 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`7f6f0b8`](https://github.com/rivo/tview/commit/7f6f0b84f61c5dd138c4669ab184f9e801007fa5) Make TextView.Clear safe ### 📊 Changes **1 file changed** (+2 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `textview.go` (+2 -0) </details> ### 📄 Description Fix https://github.com/rivo/tview/issues/636 I think the problem is TextView.Clear is not locking. When we clear the TextView, the buffer will be nil. So call Clear while drawing buffer, it will panic with that stack trace. ``` github.com/rivo/tview.(*TextView).Draw(0xc0000bc100, {0xa43700, 0xc000568000}) /home/sam/go/pkg/mod/github.com/rivo/tview@v0.0.0-20210624165335-29d673af0ce2/textview.go:1017 +0xdf4 ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 01:08:58 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#1003
No description provided.