mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2025-01-11 23:57:21 -08:00
enhance: threadsafe way to accessing _remotes
(#882)
This commit is contained in:
parent
94c532889b
commit
0e34a77add
1 changed files with 9 additions and 3 deletions
|
@ -881,7 +881,9 @@ namespace SourceGit.ViewModels
|
|||
|
||||
Dispatcher.UIThread.Invoke(() =>
|
||||
{
|
||||
lock (_lockRemotes)
|
||||
Remotes = remotes;
|
||||
|
||||
Branches = branches;
|
||||
CurrentBranch = branches.Find(x => x.IsCurrent);
|
||||
LocalBranchTrees = builder.Locals;
|
||||
|
@ -2299,8 +2301,11 @@ namespace SourceGit.ViewModels
|
|||
return;
|
||||
|
||||
var remotes = new List<string>();
|
||||
lock (_lockRemotes)
|
||||
{
|
||||
foreach (var remote in _remotes)
|
||||
remotes.Add(remote.Name);
|
||||
}
|
||||
|
||||
Dispatcher.UIThread.Invoke(() => IsAutoFetching = true);
|
||||
foreach (var remote in remotes)
|
||||
|
@ -2336,6 +2341,7 @@ namespace SourceGit.ViewModels
|
|||
private List<string> _revisionFiles = new List<string>();
|
||||
|
||||
private string _filter = string.Empty;
|
||||
private object _lockRemotes = new object();
|
||||
private List<Models.Remote> _remotes = new List<Models.Remote>();
|
||||
private List<Models.Branch> _branches = new List<Models.Branch>();
|
||||
private Models.Branch _currentBranch = null;
|
||||
|
|
Loading…
Reference in a new issue