Bounce STATUS view update onto the UI thread

refreshStatus computes the status line on the calling goroutine (as
before) but now writes it to the status view in an
onUIThreadUnlessRepoChanged bounce rather than calling SetViewContent
directly from the worker. RefreshingStatusMutex is left in place for now;
it only guards the compute phase between concurrent callers and comes out
in the mutex cleanup.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Stefan Haller 2026-07-03 15:21:20 +02:00
parent 063bba6b45
commit 4c9fdc4221

View file

@ -1048,6 +1048,8 @@ func (self *RefreshHelper) refreshStatus() {
self.c.Mutexes().RefreshingStatusMutex.Lock()
defer self.c.Mutexes().RefreshingStatusMutex.Unlock()
generation := self.c.State().GetRepoGeneration()
currentBranch := self.refsHelper.GetCheckedOutRef()
if currentBranch == nil {
// need to wait for branches to refresh
@ -1061,7 +1063,10 @@ func (self *RefreshHelper) refreshStatus() {
status := presentation.FormatStatus(repoName, currentBranch, types.ItemOperationNone, linkedWorktreeName, workingTreeState, self.c.Tr, self.c.UserConfig())
self.c.SetViewContent(self.c.Views().Status, status)
self.onUIThreadUnlessRepoChanged(generation, func() error {
self.c.SetViewContent(self.c.Views().Status, status)
return nil
})
}
func (self *RefreshHelper) refForLog() string {