1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

add mutex to prevent crashes with merge conflicts

This commit is contained in:
Jesse Duffield
2021-04-02 00:15:39 +11:00
parent efe43077bc
commit cc9293b386
4 changed files with 37 additions and 10 deletions

View File

@ -116,10 +116,11 @@ type lBlPanelState struct {
}
type mergingPanelState struct {
ConflictIndex int
ConflictTop bool
Conflicts []commands.Conflict
EditHistory *stack.Stack
ConflictIndex int
ConflictTop bool
Conflicts []commands.Conflict
ConflictsMutex sync.Mutex
EditHistory *stack.Stack
// UserScrolling tells us if the user has started scrolling through the file themselves
// in which case we won't auto-scroll to a conflict.
@ -367,10 +368,11 @@ func (gui *Gui) resetState() {
Menu: &menuPanelState{listPanelState: listPanelState{SelectedLineIdx: 0}, OnPress: nil},
Suggestions: &suggestionsPanelState{listPanelState: listPanelState{SelectedLineIdx: 0}},
Merging: &mergingPanelState{
ConflictIndex: 0,
ConflictTop: true,
Conflicts: []commands.Conflict{},
EditHistory: stack.New(),
ConflictIndex: 0,
ConflictTop: true,
Conflicts: []commands.Conflict{},
EditHistory: stack.New(),
ConflictsMutex: sync.Mutex{},
},
},
SideView: nil,