aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-09-17 15:23:52 -0500
committerRobin Jarry <robin@jarry.cc>2022-09-19 21:25:11 +0200
commitcb84df09f6d1b813787b526e3ac2faff87205b64 (patch)
tree0c21a0c3fce6d2638e509f83cc7ff86ced892341 /widgets
parent74fd5d11194d866a261a8f64d77c78a19ff2b174 (diff)
downloadaerc-cb84df09f6d1b813787b526e3ac2faff87205b64.tar.gz
terminal: don't invalidate on EventWidgetContent
The terminal widget uses it's own internal event handler to redraw itself for improved performance. The event handler draws, updates the screen, and invalidates. The last invalidate is redundant: Invalidating has the result of telling aerc to redraw the screen. A race condition can occur where an event is emitted from the terminal and the terminal is closed before the event is handled. This results in handling the event after the terminal is closed, and a panic: panic: Attempted to invalidate unknown cell goroutine 54685 [running]: git.sr.ht/~rjarry/aerc/lib/ui.(*Grid).cellInvalidated(0xc00b0a34a0, {0xbb8f10?, 0xc00360cd80}) git.sr.ht/~rjarry/aerc/lib/ui/grid.go:287 +0x175 git.sr.ht/~rjarry/aerc/lib/ui.(*Invalidatable).DoInvalidate(0xc0002e7900?, {0xbb8f10?, 0xc00360cd80?}) git.sr.ht/~rjarry/aerc/lib/ui/invalidatable.go:22 +0x82 git.sr.ht/~rjarry/aerc/widgets.(*Terminal).invalidate(...) git.sr.ht/~rjarry/aerc/widgets/terminal.go:93 git.sr.ht/~rjarry/aerc/widgets.(*Terminal).HandleEvent(0xc00360cd80, {0xbb4ba0?, 0xc006022690?}) git.sr.ht/~rjarry/aerc/widgets/terminal.go:192 +0xd2 github.com/gdamore/tcell/v2/views.(*WidgetWatchers).PostEvent(...) github.com/gdamore/tcell/v2@v2.5.3/views/widget.go:113 github.com/gdamore/tcell/v2/views.(*WidgetWatchers).PostEventWidgetContent(0xc0001b9360, {0xbbc950?, 0xc0001b9320}) github.com/gdamore/tcell/v2@v2.5.3/views/widget.go:123 +0x12b git.sr.ht/~rockorager/tcell-term.(*Terminal).run.func1() git.sr.ht/~rockorager/tcell-term@v0.1.0/terminal.go:117 +0x9d created by git.sr.ht/~rockorager/tcell-term.(*Terminal).run git.sr.ht/~rockorager/tcell-term@v0.1.0/terminal.go:104 +0x110 Don't invalidate on EventWidgetContent. The terminal already handles drawing and updating the tcell Screen internally. Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'widgets')
-rw-r--r--widgets/terminal.go1
1 files changed, 0 insertions, 1 deletions
diff --git a/widgets/terminal.go b/widgets/terminal.go
index f0d9dc96..279c2a33 100644
--- a/widgets/terminal.go
+++ b/widgets/terminal.go
@@ -189,7 +189,6 @@ func (term *Terminal) HandleEvent(ev tcell.Event) bool {
if term.ctx != nil {
term.ctx.Show()
}
- term.invalidate()
return true
case *tcellterm.EventTitle:
if term.OnTitle != nil {