aerc/widgets
Tim Culverhouse cb84df09f6 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>
2022-09-19 21:25:11 +02:00
..
account-wizard.go wizard: add plaintext password warning 2022-08-22 09:30:37 +02:00
account.go move: enable MoveMessages from msgstore 2022-08-22 15:46:55 +02:00
aerc.go terminal: improve mouse support 2022-09-15 20:59:13 +02:00
authinfo.go lint: homogenize operations and minor fixes (gocritic) 2022-08-04 21:58:01 +02:00
compose.go terminal: protect calls to terminal methods throughout aerc 2022-09-19 21:25:09 +02:00
dialog.go widgets: add dialog interface 2022-08-22 09:30:37 +02:00
dirlist.go fix: Set proper UIConfig for msgstores 2022-08-22 09:30:37 +02:00
dirtree.go dirtree: fix build errors 2022-08-22 09:57:23 +02:00
exline.go lint: homogenize operations and minor fixes (gocritic) 2022-08-04 21:58:01 +02:00
getpasswd.go lint: apply new formatting rules 2022-08-01 10:44:52 +02:00
headerlayout.go go.mod: change base git url 2021-11-05 10:21:45 +01:00
listbox.go widgets: add list box with filter/scrollbar 2022-08-22 09:30:37 +02:00
msglist.go store: improve cursor position 2022-08-22 10:01:46 +02:00
msgviewer.go terminal: protect calls to terminal methods throughout aerc 2022-09-19 21:25:09 +02:00
pgpinfo.go lint: remove ineffectual assignments (ineffassign) 2022-08-04 21:57:50 +02:00
providesmessage.go msgviewer: open http links from messages 2022-06-14 22:12:48 +02:00
scrollable.go lint: apply new formatting rules 2022-08-01 10:44:52 +02:00
selector.go lint: homogenize operations and minor fixes (gocritic) 2022-08-04 21:58:01 +02:00
spinner.go logging: added a log on panic 2022-03-23 20:56:09 +01:00
status.go uiconfig: use pointer references to uiConfig 2022-07-03 21:32:18 +02:00
tabhost.go Implement style configuration. 2020-08-06 21:42:06 +02:00
terminal.go terminal: don't invalidate on EventWidgetContent 2022-09-19 21:25:11 +02:00