mirror of
https://github.com/bitwarden/android.git
synced 2024-12-25 02:18:27 +03:00
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:
parent
6263788d6a
commit
8a059e0fbb
2 changed files with 9 additions and 6 deletions
|
@ -75,7 +75,7 @@ namespace Bit.App.Pages
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_vm.Search(e.NewTextValue, 500);
|
_vm.Search(e.NewTextValue, 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SearchBar_SearchButtonPressed(object sender, EventArgs e)
|
private void SearchBar_SearchButtonPressed(object sender, EventArgs e)
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace Bit.App.Pages
|
||||||
.GetValueOrDefault();
|
.GetValueOrDefault();
|
||||||
if(!string.IsNullOrWhiteSpace((Page as CiphersPage).SearchBar.Text))
|
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)
|
catch(OperationCanceledException)
|
||||||
{
|
{
|
||||||
ciphers = new List<CipherView>();
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ciphers == null)
|
if(ciphers == null)
|
||||||
{
|
{
|
||||||
ciphers = new List<CipherView>();
|
ciphers = new List<CipherView>();
|
||||||
}
|
}
|
||||||
Ciphers.ResetWithRange(ciphers);
|
Device.BeginInvokeOnMainThread(() =>
|
||||||
ShowNoData = searchable && Ciphers.Count == 0;
|
{
|
||||||
ShowList = searchable && !ShowNoData;
|
Ciphers.ResetWithRange(ciphers);
|
||||||
|
ShowNoData = searchable && Ciphers.Count == 0;
|
||||||
|
ShowList = searchable && !ShowNoData;
|
||||||
|
});
|
||||||
}, cts.Token);
|
}, cts.Token);
|
||||||
_searchCancellationTokenSource = cts;
|
_searchCancellationTokenSource = cts;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue