Fixed issue where multiple threads were attempting to modify search result list (#761)

* Fixed issue where multiple threads were attempting to modify search result list

* Fixed race condition
This commit is contained in:
Matt Portune 2020-03-09 18:43:28 -04:00 committed by GitHub
parent 6263788d6a
commit 8a059e0fbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View file

@ -75,7 +75,7 @@ namespace Bit.App.Pages
{
return;
}
_vm.Search(e.NewTextValue, 500);
_vm.Search(e.NewTextValue, 200);
}
private void SearchBar_SearchButtonPressed(object sender, EventArgs e)

View file

@ -77,7 +77,7 @@ namespace Bit.App.Pages
.GetValueOrDefault();
if(!string.IsNullOrWhiteSpace((Page as CiphersPage).SearchBar.Text))
{
Search((Page as CiphersPage).SearchBar.Text, 500);
Search((Page as CiphersPage).SearchBar.Text, 200);
}
}
@ -110,16 +110,19 @@ namespace Bit.App.Pages
}
catch(OperationCanceledException)
{
ciphers = new List<CipherView>();
return;
}
}
if(ciphers == null)
{
ciphers = new List<CipherView>();
}
Device.BeginInvokeOnMainThread(() =>
{
Ciphers.ResetWithRange(ciphers);
ShowNoData = searchable && Ciphers.Count == 0;
ShowList = searchable && !ShowNoData;
});
}, cts.Token);
_searchCancellationTokenSource = cts;
}