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(() =>
|
Dispatcher.UIThread.Invoke(() =>
|
||||||
{
|
{
|
||||||
Remotes = remotes;
|
lock (_lockRemotes)
|
||||||
|
Remotes = remotes;
|
||||||
|
|
||||||
Branches = branches;
|
Branches = branches;
|
||||||
CurrentBranch = branches.Find(x => x.IsCurrent);
|
CurrentBranch = branches.Find(x => x.IsCurrent);
|
||||||
LocalBranchTrees = builder.Locals;
|
LocalBranchTrees = builder.Locals;
|
||||||
|
@ -2299,8 +2301,11 @@ namespace SourceGit.ViewModels
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var remotes = new List<string>();
|
var remotes = new List<string>();
|
||||||
foreach (var remote in _remotes)
|
lock (_lockRemotes)
|
||||||
remotes.Add(remote.Name);
|
{
|
||||||
|
foreach (var remote in _remotes)
|
||||||
|
remotes.Add(remote.Name);
|
||||||
|
}
|
||||||
|
|
||||||
Dispatcher.UIThread.Invoke(() => IsAutoFetching = true);
|
Dispatcher.UIThread.Invoke(() => IsAutoFetching = true);
|
||||||
foreach (var remote in remotes)
|
foreach (var remote in remotes)
|
||||||
|
@ -2336,6 +2341,7 @@ namespace SourceGit.ViewModels
|
||||||
private List<string> _revisionFiles = new List<string>();
|
private List<string> _revisionFiles = new List<string>();
|
||||||
|
|
||||||
private string _filter = string.Empty;
|
private string _filter = string.Empty;
|
||||||
|
private object _lockRemotes = new object();
|
||||||
private List<Models.Remote> _remotes = new List<Models.Remote>();
|
private List<Models.Remote> _remotes = new List<Models.Remote>();
|
||||||
private List<Models.Branch> _branches = new List<Models.Branch>();
|
private List<Models.Branch> _branches = new List<Models.Branch>();
|
||||||
private Models.Branch _currentBranch = null;
|
private Models.Branch _currentBranch = null;
|
||||||
|
|
Loading…
Reference in a new issue