aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Culverhouse <tim@timculverhouse.com>2022-09-25 14:38:44 -0500
committerRobin Jarry <robin@jarry.cc>2022-09-26 17:31:15 +0200
commitc8c4b8c7cbfa4e05b8c96a5449188823d08fb9c4 (patch)
tree0585ab3a36fbd80848850ef4bf66b07e365bdf18
parentc89c37e8089765c9280c2256e9a099b81b5139e1 (diff)
downloadaerc-c8c4b8c7cbfa4e05b8c96a5449188823d08fb9c4.tar.gz
dirlist: avoid race from accessing ui config in Select debounce
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com> Acked-by: Robin Jarry <robin@jarry.cc>
-rw-r--r--widgets/dirlist.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/widgets/dirlist.go b/widgets/dirlist.go
index 6a8df2e9..83001b7b 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 {