aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorJose Lombera <jose@lombera.dev>2022-07-22 18:17:46 -0500
committerRobin Jarry <robin@jarry.cc>2022-07-23 21:51:52 +0200
commitc49a065496ed232399b31506031711d4c1f802e0 (patch)
tree8a34c41f6de7035b0eeac75976cf62e14d5e3576 /widgets
parent5dec1f09b1d4a642aff1f711c44eb12e61b6129c (diff)
downloadaerc-c49a065496ed232399b31506031711d4c1f802e0.tar.gz
msgviewer: cleanup PartSwitcher on :toggle-headers
Cleanup existing PartSwitcher before recreating a new one when command :toggle-headers is executed, ensuring existing part pagers are cleaned up. This fixes a leak in pager processes when :toggle-headers is executed repeatedly without closing the message. Signed-off-by: Jose Lombera <jose@lombera.dev> Acked-by: Koni Marti <koni.marti@gmail.com>
Diffstat (limited to 'widgets')
-rw-r--r--widgets/msgviewer.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go
index 24ea2fe3..59384d4b 100644
--- a/widgets/msgviewer.go
+++ b/widgets/msgviewer.go
@@ -308,6 +308,7 @@ func (mv *MessageViewer) MarkedMessages() ([]uint32, error) {
func (mv *MessageViewer) ToggleHeaders() {
switcher := mv.switcher
+ switcher.Cleanup()
mv.conf.Viewer.ShowHeaders = !mv.conf.Viewer.ShowHeaders
err := createSwitcher(mv.acct, switcher, mv.conf, mv.msg)
if err != nil {