Better SortedView fix

This commit is contained in:
John Gross
2019-07-06 17:18:15 -07:00
parent 570bc83a6d
commit e77d53fd41

View File

@@ -109,21 +109,14 @@ namespace Torch.Collections
} }
public void Refresh() public void Refresh()
{
//HACK, fix the multithreading
try
{ {
_store.Clear(); _store.Clear();
_store.AddRange(_backing); //_store.AddRange(_backing);
_store.EnsureCapacity(_backing.Count);
foreach (var e in _backing)
_store.Add(e);
Sort(); Sort();
} }
catch (IndexOutOfRangeException e)
{
_log.Error(e);
Thread.Sleep(10);
Refresh();
}
}
public void SetComparer(IComparer<T> comparer, bool resort = true) public void SetComparer(IComparer<T> comparer, bool resort = true)
{ {