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>
This commit is contained in:
Tim Culverhouse 2022-09-25 14:38:44 -05:00 committed by Robin Jarry
parent c89c37e808
commit c8c4b8c7cb

View file

@ -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 {