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: 77f69501d6
("msgviewer: properly close embedded terminal")
Signed-off-by: Robin Jarry <robin@jarry.cc>
Acked-by: Tim Culverhouse <tim@timculverhouse.com>
This commit is contained in:
parent
cb84df09f6
commit
b31bb1876b
1 changed files with 0 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue