diff --git a/wtf.go b/wtf.go index f0df2b06..da5e5afd 100644 --- a/wtf.go +++ b/wtf.go @@ -121,6 +121,8 @@ func watchForConfigChanges(app *tview.Application, configFlag string, grid *tvie select { case <-watch.Event: loadConfig(configFlag) + // Disable all widgets to stop scheduler goroutines and widgets from memory. + disableAllWidgets() makeWidgets(app, pages) grid = buildGrid(Widgets) pages.AddPage("grid", grid, true, true) @@ -155,6 +157,12 @@ var ( version = "dev" ) +func disableAllWidgets() { + for _, widget := range Widgets { + widget.Disable() + } +} + func addWidget(app *tview.Application, pages *tview.Pages, widgetName string) { // Always in alphabetical order switch widgetName {