1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-12 17:48:31 +00:00

Added dispose-check to corsairs update queue

This commit is contained in:
Darth Affe 2023-04-09 16:36:27 +02:00
parent 5b514ff962
commit 10183fb270

View File

@ -13,6 +13,8 @@ public class CorsairDeviceUpdateQueue : UpdateQueue
{
#region Properties & Fields
private bool _isDisposed = false;
private readonly _CorsairDeviceInfo _device;
private readonly nint _colorPtr;
@ -42,6 +44,7 @@ public class CorsairDeviceUpdateQueue : UpdateQueue
{
try
{
if (_isDisposed) throw new ObjectDisposedException(nameof(CorsairDeviceUpdateQueue));
if (!_CUESDK.IsConnected) return false;
Span<_CorsairLedColor> colors = new((void*)_colorPtr, dataSet.Length);
@ -71,6 +74,7 @@ public class CorsairDeviceUpdateQueue : UpdateQueue
{
base.Dispose();
_isDisposed = true;
Marshal.FreeHGlobal(_colorPtr);
GC.SuppressFinalize(this);