mirror of
https://github.com/rivo/tview.git
synced 2026-04-27 05:45:49 +03:00
[PR #328] [CLOSED] Use Lock to Clear() TextView #909
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/tview#909
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/rivo/tview/pull/328
Author: @khepin
Created: 7/26/2019
Status: ❌ Closed
Base:
master← Head:threadsafer-textview📝 Commits (1)
f92fc57Use Lock to Clear() TextView📊 Changes
1 file changed (+2 additions, -0 deletions)
View changed files
📝
textview.go(+2 -0)📄 Description
Currently it's possible to call
Clear()on a TextView while it is currentlyDraw()ing.This would result in the view having an empty buffer when it is iterating through the
lines on line 839:
text := t.buffer[index.Line][index.Pos:index.NextPos]This will then cause a panic and crash the whole program.
Since
Draw()already locks, making sure thatClear()also does will preventthe buffer from disappearing in the middle of a draw.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.