From 462d75232bdd97d73981e0854ba04347e763f4b1 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 6 Jul 2026 17:27:07 +0200 Subject: [PATCH] Look up the submodule file and branch worktree on the UI thread ResetSubmodule and fastForward each call a helper that reads the model from inside their worker: FileForSubmodule reads Model().Files and worktreeForBranch reads Model().Worktrees, racing the UI thread's model writes. Hoist both lookups above the worker dispatch. --- pkg/gui/controllers/branches_controller.go | 2 +- pkg/gui/controllers/files_controller.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/gui/controllers/branches_controller.go b/pkg/gui/controllers/branches_controller.go index 9b9e9e546..a886a410b 100644 --- a/pkg/gui/controllers/branches_controller.go +++ b/pkg/gui/controllers/branches_controller.go @@ -710,9 +710,9 @@ func (self *BranchesController) fastForward(branch *models.Branch) error { } action := self.c.Tr.Actions.FastForwardBranch + worktree, ok := self.worktreeForBranch(branch) return self.c.WithInlineStatus(branch, types.ItemOperationFastForwarding, context.LOCAL_BRANCHES_CONTEXT_KEY, func(task gocui.Task) error { - worktree, ok := self.worktreeForBranch(branch) if ok { self.c.LogAction(action) diff --git a/pkg/gui/controllers/files_controller.go b/pkg/gui/controllers/files_controller.go index fc35518e7..b70b67ab7 100644 --- a/pkg/gui/controllers/files_controller.go +++ b/pkg/gui/controllers/files_controller.go @@ -1791,10 +1791,10 @@ func (self *FilesController) remove(selectedNodes []*filetree.FileNode) error { } func (self *FilesController) ResetSubmodule(submodule *models.SubmoduleConfig) error { + file := self.c.Helpers().WorkingTree.FileForSubmodule(submodule) return self.c.WithWaitingStatus(self.c.Tr.ResettingSubmoduleStatus, func(gocui.Task) error { self.c.LogAction(self.c.Tr.Actions.ResetSubmodule) - file := self.c.Helpers().WorkingTree.FileForSubmodule(submodule) if file != nil { if err := self.c.Git().WorkingTree.UnStageFile(file.Names(), file.Tracked); err != nil { return err