Fix race condition when starting several command tasks in quick succession

See https://github.com/jesseduffield/lazygit/issues/4507 for an elaborate
description.
This commit is contained in:
Stefan Haller 2025-04-27 10:48:43 +02:00
parent 829aa3c6af
commit 3302a090f9

View file

@ -373,8 +373,6 @@ func (self *ViewBufferManager) NewTask(f func(TaskOpts) error, key string) error
go utils.Safe(func() {
defer completeGocuiTask()
self.readLines = nil
self.taskIDMutex.Lock()
self.newTaskID++
taskID := self.newTaskID
@ -400,6 +398,8 @@ func (self *ViewBufferManager) NewTask(f func(TaskOpts) error, key string) error
self.stopCurrentTask()
}
self.readLines = nil
stop := make(chan struct{})
notifyStopped := make(chan struct{})