aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2022-09-19 15:18:46 +0200
committerRobin Jarry <robin@jarry.cc>2022-09-19 21:25:13 +0200
commitb31bb1876bee90434496d852f55a820fa3a26ca5 (patch)
tree333a93d0060853e46824a03caa56b8f9a25ecb22
parentcb84df09f6d1b813787b526e3ac2faff87205b64 (diff)
downloadaerc-b31bb1876bee90434496d852f55a820fa3a26ca5.tar.gz
msgviewer: fix segfault when closing viewer
There is a race between PartViewer.Cleanup and PartViewer.Draw. pv.term may be not nil in Draw and Cleanup() may set it to nil before pv.term.Draw() is called, causing an invalid memory access: [signal SIGSEGV: segmentation violation code=0x1 addr=0x29 pc=0x9413b8] git.sr.ht/~rjarry/aerc/widgets.(*Terminal).Draw(0x0?, 0x0?) git.sr.ht/~rjarry/aerc/widgets/terminal.go:97 +0x18 git.sr.ht/~rjarry/aerc/widgets.(*PartViewer).Draw(0xc00012a540, 0xc0026ea690) git.sr.ht/~rjarry/aerc/widgets/msgviewer.go:862 +0x2fd There is no need to reset term to nil. Fixes: 77f69501d648 ("msgviewer: properly close embedded terminal") Signed-off-by: Robin Jarry <robin@jarry.cc> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
-rw-r--r--widgets/msgviewer.go1
1 files changed, 0 insertions, 1 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index 33b6e729..d5d1d279 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -867,7 +867,6 @@ func (pv *PartViewer) Draw(ctx *ui.Context) {
func (pv *PartViewer) Cleanup() {
if pv.term != nil {
pv.term.Close(nil)
- pv.term = nil
}
}