~sircmpwn/aerc

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH 1/2] Cleanup pager processes after closing a msgviewer

Details
Message ID
<20191015090148.326137-1-keur@xcf.berkeley.edu>
DKIM signature
missing
Download raw message
Patch: +18 -0
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>
---
 commands/msgview/close.go |  1 +
 widgets/msgviewer.go      | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/commands/msgview/close.go b/commands/msgview/close.go
index 9966735..ed86405 100644
--- a/commands/msgview/close.go
+++ b/commands/msgview/close.go
@@ -25,6 +25,7 @@ func (Close) Execute(aerc *widgets.Aerc, args []string) error {
 		return errors.New("Usage: close")
 	}
 	mv, _ := aerc.SelectedTab().(*widgets.MessageViewer)
+	mv.Close()
 	aerc.RemoveTab(mv)
 	return nil
 }
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index c179070..d5bbace 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
--
2.23.0

[PATCH 2/2] widgets/msgview: Reap the filter command

Details
Message ID
<20191015090148.326137-2-keur@xcf.berkeley.edu>
In-Reply-To
<20191015090148.326137-1-keur@xcf.berkeley.edu> (view parent)
DKIM signature
missing
Download raw message
Patch: +1 -0
The filter command shells out and returns almost immediately. Call
Wait() so the filter process gets reaped. Prior to this patch, aerc
creates a zombie process for every email that is viewed.

Signed-off-by: Kevin Kuehler <keur@xcf.berkeley.edu>
---
 widgets/msgviewer.go | 1 +
 1 file changed, 1 insertion(+)

diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index d5bbace..05da2a0 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -537,6 +537,7 @@ func (pv *PartViewer) attemptCopy() {
 			go func() {
 				<-ch
 				<-ch
+				pv.filter.Wait()
 				pv.pagerin.Close()
 			}()
 		}
--
2.23.0

Re: [PATCH 2/2] widgets/msgview: Reap the filter command

Details
Message ID
<BXR1OYE4Q7CS.1RCRI1XCC198G@homura>
In-Reply-To
<20191015090148.326137-2-keur@xcf.berkeley.edu> (view parent)
DKIM signature
pass
Download raw message
Thanks!

To git.sr.ht:~sircmpwn/aerc
   550ef0b..310bec2  master -> master