[PR #1105] [CLOSED] Fix race conditions in TreeView #1128

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

📋 Pull Request Information

Original PR: https://github.com/rivo/tview/pull/1105
Author: @roelvandergoot
Created: 7/26/2025
Status: Closed

Base: masterHead: roel/TreeView


📝 Commits (1)

  • 6f22d69 Fix race conditions in TreeView

📊 Changes

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

View changed files

📝 treeview.go (+96 -2)

📄 Description

When you:
1.Represent a directory tree as a TreeView,
2. Use a state machine go-routine per leaf TreeNode, and
3. Append the current state name of the state machine to the TreeNode's using TreeNode.SetText(),
a race condition exists between TreeNode.SetText() and TreeView.Draw()

You can't solve the race condition by embedding rivo.TreeView and rivo.TreeNodes in your own TreeView and TreeNodes. Hence this pull request.


🔄 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/1105 **Author:** [@roelvandergoot](https://github.com/roelvandergoot) **Created:** 7/26/2025 **Status:** ❌ Closed **Base:** `master` ← **Head:** `roel/TreeView` --- ### 📝 Commits (1) - [`6f22d69`](https://github.com/rivo/tview/commit/6f22d69eb0fef62edeb5ba9bc85822da492697c8) Fix race conditions in TreeView ### 📊 Changes **1 file changed** (+96 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `treeview.go` (+96 -2) </details> ### 📄 Description When you: 1.Represent a directory tree as a `TreeView`, 2. Use a state machine go-routine per leaf `TreeNode`, and 3. Append the current state name of the state machine to the `TreeNode`'s using `TreeNode.SetText()`, a race condition exists between `TreeNode.SetText()` and `TreeView.Draw()` You can't solve the race condition by embedding `rivo.TreeView` and `rivo.TreeNode`s in your own `TreeView` and `TreeNode`s. Hence this pull request. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 01:09:35 +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#1128
No description provided.