Skip to content

Commit 8bbfd4b

Browse files
authored
Fix race condition when starting several command tasks in quick succession (#4518)
- **PR Description** Fixes #4507, see there for an elaborate description of the problem.
2 parents 829aa3c + 3302a09 commit 8bbfd4b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/tasks/tasks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,8 +373,6 @@ func (self *ViewBufferManager) NewTask(f func(TaskOpts) error, key string) error
373373
go utils.Safe(func() {
374374
defer completeGocuiTask()
375375

376-
self.readLines = nil
377-
378376
self.taskIDMutex.Lock()
379377
self.newTaskID++
380378
taskID := self.newTaskID
@@ -400,6 +398,8 @@ func (self *ViewBufferManager) NewTask(f func(TaskOpts) error, key string) error
400398
self.stopCurrentTask()
401399
}
402400

401+
self.readLines = nil
402+
403403
stop := make(chan struct{})
404404
notifyStopped := make(chan struct{})
405405

0 commit comments

Comments
 (0)