mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2025-12-13 10:08:31 +00:00
Added dispose-check to corsairs update queue
This commit is contained in:
parent
5b514ff962
commit
10183fb270
@ -13,6 +13,8 @@ public class CorsairDeviceUpdateQueue : UpdateQueue
|
|||||||
{
|
{
|
||||||
#region Properties & Fields
|
#region Properties & Fields
|
||||||
|
|
||||||
|
private bool _isDisposed = false;
|
||||||
|
|
||||||
private readonly _CorsairDeviceInfo _device;
|
private readonly _CorsairDeviceInfo _device;
|
||||||
private readonly nint _colorPtr;
|
private readonly nint _colorPtr;
|
||||||
|
|
||||||
@ -42,6 +44,7 @@ public class CorsairDeviceUpdateQueue : UpdateQueue
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (_isDisposed) throw new ObjectDisposedException(nameof(CorsairDeviceUpdateQueue));
|
||||||
if (!_CUESDK.IsConnected) return false;
|
if (!_CUESDK.IsConnected) return false;
|
||||||
|
|
||||||
Span<_CorsairLedColor> colors = new((void*)_colorPtr, dataSet.Length);
|
Span<_CorsairLedColor> colors = new((void*)_colorPtr, dataSet.Length);
|
||||||
@ -71,6 +74,7 @@ public class CorsairDeviceUpdateQueue : UpdateQueue
|
|||||||
{
|
{
|
||||||
base.Dispose();
|
base.Dispose();
|
||||||
|
|
||||||
|
_isDisposed = true;
|
||||||
Marshal.FreeHGlobal(_colorPtr);
|
Marshal.FreeHGlobal(_colorPtr);
|
||||||
|
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user