mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-05 00:59:19 +02:00
Instantiate other mutexes by value
Like in the previous commit, this is preferred because the fields don't need to be initialized this way.
This commit is contained in:
@ -21,7 +21,7 @@ type MainBranches struct {
|
||||
previousMainBranches []string
|
||||
|
||||
cmd oscommands.ICmdObjBuilder
|
||||
mutex *deadlock.Mutex
|
||||
mutex deadlock.Mutex
|
||||
}
|
||||
|
||||
func NewMainBranches(
|
||||
@ -32,7 +32,6 @@ func NewMainBranches(
|
||||
c: cmn,
|
||||
existingMainBranches: nil,
|
||||
cmd: cmd,
|
||||
mutex: &deadlock.Mutex{},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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{},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ type MergeConflictsContext struct {
|
||||
types.Context
|
||||
viewModel *ConflictsViewModel
|
||||
c *ContextCommon
|
||||
mutex *deadlock.Mutex
|
||||
mutex deadlock.Mutex
|
||||
}
|
||||
|
||||
type ConflictsViewModel struct {
|
||||
@ -33,7 +33,6 @@ func NewMergeConflictsContext(
|
||||
|
||||
return &MergeConflictsContext{
|
||||
viewModel: viewModel,
|
||||
mutex: &deadlock.Mutex{},
|
||||
Context: NewSimpleContext(
|
||||
NewBaseContext(NewBaseContextOpts{
|
||||
Kind: types.MAIN_CONTEXT,
|
||||
@ -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) {
|
||||
|
@ -15,7 +15,7 @@ type PatchExplorerContext struct {
|
||||
viewTrait *ViewTrait
|
||||
getIncludedLineIndices func() []int
|
||||
c *ContextCommon
|
||||
mutex *deadlock.Mutex
|
||||
mutex deadlock.Mutex
|
||||
}
|
||||
|
||||
var (
|
||||
@ -36,7 +36,6 @@ func NewPatchExplorerContext(
|
||||
state: nil,
|
||||
viewTrait: NewViewTrait(view),
|
||||
c: c,
|
||||
mutex: &deadlock.Mutex{},
|
||||
getIncludedLineIndices: getIncludedLineIndices,
|
||||
SimpleContext: NewSimpleContext(NewBaseContext(NewBaseContextOpts{
|
||||
View: view,
|
||||
@ -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 {
|
||||
|
@ -15,7 +15,7 @@ type InlineStatusHelper struct {
|
||||
|
||||
windowHelper *WindowHelper
|
||||
contextsWithInlineStatus map[types.ContextKey]*inlineStatusInfo
|
||||
mutex *deadlock.Mutex
|
||||
mutex deadlock.Mutex
|
||||
}
|
||||
|
||||
func NewInlineStatusHelper(c *HelperCommon, windowHelper *WindowHelper) *InlineStatusHelper {
|
||||
@ -23,7 +23,6 @@ func NewInlineStatusHelper(c *HelperCommon, windowHelper *WindowHelper) *InlineS
|
||||
c: c,
|
||||
windowHelper: windowHelper,
|
||||
contextsWithInlineStatus: make(map[types.ContextKey]*inlineStatusInfo),
|
||||
mutex: &deadlock.Mutex{},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
@ -685,7 +685,6 @@ func NewGui(
|
||||
afterLayoutFuncs: make(chan func() error, 1000),
|
||||
|
||||
itemOperations: make(map[string]types.ItemOperation),
|
||||
itemOperationsMutex: &deadlock.Mutex{},
|
||||
}
|
||||
|
||||
gui.PopupHandler = popup.NewPopupHandler(
|
||||
|
Reference in New Issue
Block a user