1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-13 01:58:30 +00:00

Fixed devices not beeing updated

This commit is contained in:
Darth Affe 2021-03-05 21:40:51 +01:00
parent 20347cf221
commit 47fd3ff203

View File

@ -47,12 +47,13 @@ namespace RGB.NET.Core
protected virtual void OnUpdate(object? sender, CustomUpdateData customData)
{
(TIdentifier, TData)[] dataSet;
Span<(TIdentifier, TData)> data;
lock (_dataLock)
{
if (_currentDataSet.Count == 0) return;
dataSet = ArrayPool<(TIdentifier, TData)>.Shared.Rent(_currentDataSet.Count);
Span<(TIdentifier, TData)> data = new Span<(TIdentifier, TData)>(dataSet).Slice(0, _currentDataSet.Count);
data = new Span<(TIdentifier, TData)>(dataSet).Slice(0, _currentDataSet.Count);
int i = 0;
foreach ((TIdentifier key, TData value) in _currentDataSet)
@ -61,8 +62,7 @@ namespace RGB.NET.Core
_currentDataSet.Clear();
}
if (dataSet.Length != 0)
Update(dataSet);
Update(data);
ArrayPool<(TIdentifier, TData)>.Shared.Return(dataSet);
}