mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-03 00:57:52 +02:00
Instantiate Mutexes's fields by value
Instead, pass the entire Mutexes struct by pointer to controllers. This is better because Mutexes now has a zero value and doesn't need to be initialized.
This commit is contained in:
@ -681,17 +681,6 @@ func NewGui(
|
|||||||
// real value after loading the user config:
|
// real value after loading the user config:
|
||||||
ShowExtrasWindow: true,
|
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,
|
InitialDir: initialDir,
|
||||||
afterLayoutFuncs: make(chan func() error, 1000),
|
afterLayoutFuncs: make(chan func() error, 1000),
|
||||||
|
|
||||||
|
@ -100,8 +100,8 @@ func (self *guiCommon) Model() *types.Model {
|
|||||||
return self.gui.State.Model
|
return self.gui.State.Model
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *guiCommon) Mutexes() types.Mutexes {
|
func (self *guiCommon) Mutexes() *types.Mutexes {
|
||||||
return self.gui.Mutexes
|
return &self.gui.Mutexes
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *guiCommon) GocuiGui() *gocui.Gui {
|
func (self *guiCommon) GocuiGui() *gocui.Gui {
|
||||||
|
@ -94,7 +94,7 @@ type IGuiCommon interface {
|
|||||||
|
|
||||||
Modes() *Modes
|
Modes() *Modes
|
||||||
|
|
||||||
Mutexes() Mutexes
|
Mutexes() *Mutexes
|
||||||
|
|
||||||
State() IStateAccessor
|
State() IStateAccessor
|
||||||
|
|
||||||
@ -313,18 +313,16 @@ type Model struct {
|
|||||||
HashPool *utils.StringPool
|
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 {
|
type Mutexes struct {
|
||||||
RefreshingFilesMutex *deadlock.Mutex
|
RefreshingFilesMutex deadlock.Mutex
|
||||||
RefreshingBranchesMutex *deadlock.Mutex
|
RefreshingBranchesMutex deadlock.Mutex
|
||||||
RefreshingStatusMutex *deadlock.Mutex
|
RefreshingStatusMutex deadlock.Mutex
|
||||||
LocalCommitsMutex *deadlock.Mutex
|
LocalCommitsMutex deadlock.Mutex
|
||||||
SubCommitsMutex *deadlock.Mutex
|
SubCommitsMutex deadlock.Mutex
|
||||||
AuthorsMutex *deadlock.Mutex
|
AuthorsMutex deadlock.Mutex
|
||||||
SubprocessMutex *deadlock.Mutex
|
SubprocessMutex deadlock.Mutex
|
||||||
PopupMutex *deadlock.Mutex
|
PopupMutex deadlock.Mutex
|
||||||
PtyMutex *deadlock.Mutex
|
PtyMutex deadlock.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
// A long-running operation associated with an item. For example, we'll show
|
// A long-running operation associated with an item. For example, we'll show
|
||||||
|
Reference in New Issue
Block a user