Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pkg/commands/git_commands/main_branches.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type MainBranches struct {
previousMainBranches []string

cmd oscommands.ICmdObjBuilder
mutex *deadlock.Mutex
mutex deadlock.Mutex
}

func NewMainBranches(
Expand All @@ -32,7 +32,6 @@ func NewMainBranches(
c: cmn,
existingMainBranches: nil,
cmd: cmd,
mutex: &deadlock.Mutex{},
}
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/gui/context/filtered_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ type FilteredList[T any] struct {
getFilterFields func(T) []string
filter string

mutex *deadlock.Mutex
mutex deadlock.Mutex
}

func NewFilteredList[T any](getList func() []T, getFilterFields func(T) []string) *FilteredList[T] {
return &FilteredList[T]{
getList: getList,
getFilterFields: getFilterFields,
mutex: &deadlock.Mutex{},
}
}

Expand Down
5 changes: 2 additions & 3 deletions pkg/gui/context/merge_conflicts_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type MergeConflictsContext struct {
types.Context
viewModel *ConflictsViewModel
c *ContextCommon
mutex *deadlock.Mutex
mutex deadlock.Mutex
}

type ConflictsViewModel struct {
Expand All @@ -33,7 +33,6 @@ func NewMergeConflictsContext(

return &MergeConflictsContext{
viewModel: viewModel,
mutex: &deadlock.Mutex{},
Context: NewSimpleContext(
NewBaseContext(NewBaseContextOpts{
Kind: types.MAIN_CONTEXT,
Expand All @@ -57,7 +56,7 @@ func (self *MergeConflictsContext) SetState(state *mergeconflicts.State) {
}

func (self *MergeConflictsContext) GetMutex() *deadlock.Mutex {
return self.mutex
return &self.mutex
}

func (self *MergeConflictsContext) SetUserScrolling(isScrolling bool) {
Expand Down
5 changes: 2 additions & 3 deletions pkg/gui/context/patch_explorer_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type PatchExplorerContext struct {
viewTrait *ViewTrait
getIncludedLineIndices func() []int
c *ContextCommon
mutex *deadlock.Mutex
mutex deadlock.Mutex
}

var (
Expand All @@ -36,7 +36,6 @@ func NewPatchExplorerContext(
state: nil,
viewTrait: NewViewTrait(view),
c: c,
mutex: &deadlock.Mutex{},
getIncludedLineIndices: getIncludedLineIndices,
SimpleContext: NewSimpleContext(NewBaseContext(NewBaseContextOpts{
View: view,
Expand Down Expand Up @@ -137,7 +136,7 @@ func (self *PatchExplorerContext) NavigateTo(selectedLineIdx int) {
}

func (self *PatchExplorerContext) GetMutex() *deadlock.Mutex {
return self.mutex
return &self.mutex
}

func (self *PatchExplorerContext) ModelSearchResults(searchStr string, caseSensitive bool) []gocui.SearchPosition {
Expand Down
3 changes: 1 addition & 2 deletions pkg/gui/controllers/helpers/inline_status_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ type InlineStatusHelper struct {

windowHelper *WindowHelper
contextsWithInlineStatus map[types.ContextKey]*inlineStatusInfo
mutex *deadlock.Mutex
mutex deadlock.Mutex
}

func NewInlineStatusHelper(c *HelperCommon, windowHelper *WindowHelper) *InlineStatusHelper {
return &InlineStatusHelper{
c: c,
windowHelper: windowHelper,
contextsWithInlineStatus: make(map[types.ContextKey]*inlineStatusInfo),
mutex: &deadlock.Mutex{},
}
}

Expand Down
16 changes: 2 additions & 14 deletions pkg/gui/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ type Gui struct {
// is being pushed). At the moment the rule is to use an item operation when
// we need to talk to the remote.
itemOperations map[string]types.ItemOperation
itemOperationsMutex *deadlock.Mutex
itemOperationsMutex deadlock.Mutex

PrevLayout PrevLayout

Expand Down Expand Up @@ -681,22 +681,10 @@ func NewGui(
// real value after loading the user config:
ShowExtrasWindow: true,

Mutexes: types.Mutexes{
RefreshingFilesMutex: &deadlock.Mutex{},
RefreshingBranchesMutex: &deadlock.Mutex{},
RefreshingStatusMutex: &deadlock.Mutex{},
LocalCommitsMutex: &deadlock.Mutex{},
SubCommitsMutex: &deadlock.Mutex{},
AuthorsMutex: &deadlock.Mutex{},
SubprocessMutex: &deadlock.Mutex{},
PopupMutex: &deadlock.Mutex{},
PtyMutex: &deadlock.Mutex{},
},
InitialDir: initialDir,
afterLayoutFuncs: make(chan func() error, 1000),

itemOperations: make(map[string]types.ItemOperation),
itemOperationsMutex: &deadlock.Mutex{},
itemOperations: make(map[string]types.ItemOperation),
}

gui.PopupHandler = popup.NewPopupHandler(
Expand Down
4 changes: 2 additions & 2 deletions pkg/gui/gui_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ func (self *guiCommon) Model() *types.Model {
return self.gui.State.Model
}

func (self *guiCommon) Mutexes() types.Mutexes {
return self.gui.Mutexes
func (self *guiCommon) Mutexes() *types.Mutexes {
return &self.gui.Mutexes
}

func (self *guiCommon) GocuiGui() *gocui.Gui {
Expand Down
22 changes: 10 additions & 12 deletions pkg/gui/types/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ type IGuiCommon interface {

Modes() *Modes

Mutexes() Mutexes
Mutexes() *Mutexes

State() IStateAccessor

Expand Down Expand Up @@ -313,18 +313,16 @@ type Model struct {
HashPool *utils.StringPool
}

// if you add a new mutex here be sure to instantiate it. We're using pointers to
// mutexes so that we can pass the mutexes to controllers.
type Mutexes struct {
RefreshingFilesMutex *deadlock.Mutex
RefreshingBranchesMutex *deadlock.Mutex
RefreshingStatusMutex *deadlock.Mutex
LocalCommitsMutex *deadlock.Mutex
SubCommitsMutex *deadlock.Mutex
AuthorsMutex *deadlock.Mutex
SubprocessMutex *deadlock.Mutex
PopupMutex *deadlock.Mutex
PtyMutex *deadlock.Mutex
RefreshingFilesMutex deadlock.Mutex
RefreshingBranchesMutex deadlock.Mutex
RefreshingStatusMutex deadlock.Mutex
LocalCommitsMutex deadlock.Mutex
SubCommitsMutex deadlock.Mutex
AuthorsMutex deadlock.Mutex
SubprocessMutex deadlock.Mutex
PopupMutex deadlock.Mutex
PtyMutex deadlock.Mutex
}

// A long-running operation associated with an item. For example, we'll show
Expand Down
Loading