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:
parent
c89c37e808
commit
c8c4b8c7cb
1 changed files with 2 additions and 1 deletions
|
@ -149,12 +149,13 @@ func (dirlist *DirectoryList) Select(name string) {
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
dirlist.skipSelect = ctx
|
dirlist.skipSelect = ctx
|
||||||
dirlist.skipSelectCancel = cancel
|
dirlist.skipSelectCancel = cancel
|
||||||
|
delay := dirlist.UiConfig(name).DirListDelay
|
||||||
|
|
||||||
go func(ctx context.Context) {
|
go func(ctx context.Context) {
|
||||||
defer logging.PanicHandler()
|
defer logging.PanicHandler()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-time.After(dirlist.UiConfig(name).DirListDelay):
|
case <-time.After(delay):
|
||||||
newStore := true
|
newStore := true
|
||||||
for _, s := range dirlist.store.List() {
|
for _, s := range dirlist.store.List() {
|
||||||
if s == dirlist.selecting {
|
if s == dirlist.selecting {
|
||||||
|
|
Loading…
Reference in a new issue