[GH-ISSUE #705] Application deadlock with very high CPU usage on pressing the Up key in a blank Table #516

Closed
opened 2026-03-04 01:05:39 +03:00 by kerem · 2 comments
Owner

Originally created by @darkhz on GitHub (Mar 7, 2022).
Original GitHub issue: https://github.com/rivo/tview/issues/705

Please treat this as a critical issue. A pull request has been made, see #706.

When a blank Table is:

  • Selectable (Table.SetSelectable(true, true))
  • In Focus, and
  • the Up key is pressed,

the application immediately deadlocks and incurs extremely high CPU usage.

Here is the code that illustrates the issue

package main

import (
	"github.com/rivo/tview"
)

func main() {
	App := tview.NewApplication()

	Table := tview.NewTable()
	Table.SetBorder(true)
	Table.SetSelectable(true, true)

	TextView := tview.NewTextView().
		SetText("To trigger the application deadlock, press the Up key.")

	Flex := tview.NewFlex().
		AddItem(Table, 0, 1, true).
		AddItem(TextView, 0, 1, false).
		SetDirection(tview.FlexRow)

	if err := App.SetRoot(Flex, true).SetFocus(Table).Run(); err != nil {
		panic(err)
	}
}
Originally created by @darkhz on GitHub (Mar 7, 2022). Original GitHub issue: https://github.com/rivo/tview/issues/705 Please treat this as a critical issue. A pull request has been made, see #706. When a blank Table is: - Selectable (`Table.SetSelectable(true, true)`) - In Focus, and - the Up key is pressed, the application immediately deadlocks and incurs extremely high CPU usage. Here is the code that illustrates the issue ```go package main import ( "github.com/rivo/tview" ) func main() { App := tview.NewApplication() Table := tview.NewTable() Table.SetBorder(true) Table.SetSelectable(true, true) TextView := tview.NewTextView(). SetText("To trigger the application deadlock, press the Up key.") Flex := tview.NewFlex(). AddItem(Table, 0, 1, true). AddItem(TextView, 0, 1, false). SetDirection(tview.FlexRow) if err := App.SetRoot(Flex, true).SetFocus(Table).Run(); err != nil { panic(err) } } ```
kerem closed this issue 2026-03-04 01:05:39 +03:00
Author
Owner

@darkhz commented on GitHub (Mar 7, 2022):

cc @rivo @tslocum(since this might affect cview, please test)

<!-- gh-comment-id:1060774554 --> @darkhz commented on GitHub (Mar 7, 2022): cc @rivo @tslocum(since this might affect cview, please test)
Author
Owner

@rivo commented on GitHub (Mar 7, 2022):

Thanks. Should be fixed with the latest commit.

<!-- gh-comment-id:1061199265 --> @rivo commented on GitHub (Mar 7, 2022): Thanks. Should be fixed with the latest commit.
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#516
No description provided.