aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/msgviewer.go
diff options
context:
space:
mode:
authorKevin Kuehler <keur@xcf.berkeley.edu>2019-10-15 02:01:47 -0700
committerDrew DeVault <sir@cmpwn.com>2019-10-16 11:13:53 -0400
commitbe4ea0d96b8cc70becb94f2d4e5abe41dea58f3a (patch)
tree18ec2c9fb9a66522ea71f72f33d699d0bef6c3bf /widgets/msgviewer.go
parent550ef0bc1f21dfaeb1bf216b28c3fce9a816cb73 (diff)
downloadaerc-be4ea0d96b8cc70becb94f2d4e5abe41dea58f3a.tar.gz
Cleanup pager processes after closing a msgviewer
A pager is spawned every time an email is viewed but not killed off when quitting the msgviewer, thus leading to process leakage. This patch fixes this by adding a Close method to the msgview widget, which is called in the close command. Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
Diffstat (limited to 'widgets/msgviewer.go')
-rw-r--r--widgets/msgviewer.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index c1790707..d5bbace7 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -284,6 +284,10 @@ func (mv *MessageViewer) NextPart() {
mv.Invalidate()
}
+func (mv *MessageViewer) Close() {
+ mv.switcher.Cleanup()
+}
+
func (ps *PartSwitcher) Invalidate() {
ps.DoInvalidate(ps)
}
@@ -381,6 +385,12 @@ func (ps *PartSwitcher) MouseEvent(localX int, localY int, event tcell.Event) {
}
}
+func (ps *PartSwitcher) Cleanup() {
+ for _, partViewer := range ps.parts {
+ partViewer.Cleanup()
+ }
+}
+
func (mv *MessageViewer) Event(event tcell.Event) bool {
return mv.switcher.Event(event)
}
@@ -593,6 +603,13 @@ func (pv *PartViewer) Draw(ctx *ui.Context) {
pv.term.Draw(ctx)
}
+func (pv *PartViewer) Cleanup() {
+ if pv.pager != nil && pv.pager.Process != nil {
+ pv.pager.Process.Kill()
+ pv.pager = nil
+ }
+}
+
type HeaderView struct {
ui.Invalidatable
Name string