mirror of
https://github.com/rivo/tview.git
synced 2024-11-07 03:20:39 +00:00
Application does not lock on PollEvent() call anymore. Should resolve gridlocks when calling SetRoot() in goroutines. Resolves #6
This commit is contained in:
parent
fee6bd1ef9
commit
17c785e1f8
@ -112,15 +112,18 @@ func (a *Application) Run() error {
|
||||
// Start event loop.
|
||||
for {
|
||||
a.RLock()
|
||||
if a.screen == nil {
|
||||
a.RUnlock()
|
||||
screen := a.screen
|
||||
a.RUnlock()
|
||||
if screen == nil {
|
||||
break
|
||||
}
|
||||
|
||||
// Wait for next event.
|
||||
event := a.screen.PollEvent()
|
||||
a.RUnlock()
|
||||
if event == nil {
|
||||
break // The screen was finalized.
|
||||
}
|
||||
|
||||
switch event := event.(type) {
|
||||
case *tcell.EventKey:
|
||||
a.RLock()
|
||||
|
Loading…
Reference in New Issue
Block a user