From c49a065496ed232399b31506031711d4c1f802e0 Mon Sep 17 00:00:00 2001 From: Jose Lombera Date: Fri, 22 Jul 2022 18:17:46 -0500 Subject: 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 Acked-by: Koni Marti --- widgets/msgviewer.go | 1 + 1 file changed, 1 insertion(+) diff --git a/widgets/msgviewer.go b/widgets/msgviewer.go index 24ea2fe..59384d4 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 { -- cgit v1.2.3