From c8c4b8c7cbfa4e05b8c96a5449188823d08fb9c4 Mon Sep 17 00:00:00 2001 From: Tim Culverhouse Date: Sun, 25 Sep 2022 14:38:44 -0500 Subject: [PATCH] dirlist: avoid race from accessing ui config in Select debounce Signed-off-by: Tim Culverhouse Acked-by: Robin Jarry --- widgets/dirlist.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/widgets/dirlist.go b/widgets/dirlist.go index 6a8df2e..83001b7 100644 --- a/widgets/dirlist.go +++ b/widgets/dirlist.go @@ -149,12 +149,13 @@ func (dirlist *DirectoryList) Select(name string) { ctx, cancel := context.WithCancel(context.Background()) dirlist.skipSelect = ctx dirlist.skipSelectCancel = cancel + delay := dirlist.UiConfig(name).DirListDelay go func(ctx context.Context) { defer logging.PanicHandler() select { - case <-time.After(dirlist.UiConfig(name).DirListDelay): + case <-time.After(delay): newStore := true for _, s := range dirlist.store.List() { if s == dirlist.selecting {