From 14684d33933509a2c153b4b01834c0973856b707 Mon Sep 17 00:00:00 2001 From: Crash129 Date: Thu, 18 Jan 2024 03:11:13 +0100 Subject: [PATCH] abort handleRedraws goroutine when reading from closed channel (#1617) Co-authored-by: Crash129 <10711762+Crash129@users.noreply.github.com> --- app/wtf_app.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/wtf_app.go b/app/wtf_app.go index 5741ce270..463057492 100644 --- a/app/wtf_app.go +++ b/app/wtf_app.go @@ -11,6 +11,7 @@ import ( "github.com/olebedev/config" "github.com/radovskyb/watcher" "github.com/rivo/tview" + "github.com/wtfutil/wtf/cfg" "github.com/wtfutil/wtf/support" "github.com/wtfutil/wtf/utils" @@ -93,7 +94,10 @@ func handleRedraws(tviewApp *tview.Application, redrawChan chan bool) { } for { - data := <-redrawChan + data, ok := <-redrawChan + if !ok { + return + } if data { tviewApp.Draw()