From c0adbad5999d104b731a0ac28c548a171325a66a Mon Sep 17 00:00:00 2001 From: DarthAffe Date: Sat, 9 Mar 2024 12:15:21 +0100 Subject: [PATCH 1/2] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75b3d063..bd31f5e0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: uses: PaulHatch/semantic-version@v4.0.3 with: short_tags: false - format: "${major}.${minor}.${patch}-prerelease.${increment}" + format: "${major}.${minor}.${patch}" - name: Restore dependencies run: dotnet restore - name: Build From 8f7e24ba33e88098c179ccee33d57d3b505649ba Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Tue, 19 Mar 2024 22:03:55 +0100 Subject: [PATCH 2/2] Fixed potential callback collection in CorsairDeviceProvider --- RGB.NET.Devices.Corsair/Native/_CUESDK.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/RGB.NET.Devices.Corsair/Native/_CUESDK.cs b/RGB.NET.Devices.Corsair/Native/_CUESDK.cs index 00d9f922..38324e35 100644 --- a/RGB.NET.Devices.Corsair/Native/_CUESDK.cs +++ b/RGB.NET.Devices.Corsair/Native/_CUESDK.cs @@ -47,6 +47,9 @@ internal static unsafe class _CUESDK #region Properties & Fields + // ReSharper disable once NotAccessedField.Local - This is important, the delegate can be collected if it's not stored! + private static readonly CorsairSessionStateChangedHandler SESSION_STATE_CHANGED_CALLBACK; + internal static bool IsConnected => SesionState == CorsairSessionState.Connected; internal static CorsairSessionState SesionState { get; private set; } @@ -58,6 +61,15 @@ internal static unsafe class _CUESDK #endregion + #region Constructors + + static _CUESDK() + { + SESSION_STATE_CHANGED_CALLBACK = CorsairSessionStateChangedCallback; + } + + #endregion + #region Methods private static void CorsairSessionStateChangedCallback(nint context, _CorsairSessionStateChanged eventdata) @@ -174,7 +186,7 @@ internal static CorsairError CorsairConnect() { if (_corsairConnectPtr == null) throw new RGBDeviceException("The Corsair-SDK is not initialized."); if (IsConnected) throw new RGBDeviceException("The Corsair-SDK is already connected."); - return _corsairConnectPtr(CorsairSessionStateChangedCallback, 0); + return _corsairConnectPtr(SESSION_STATE_CHANGED_CALLBACK, 0); } internal static CorsairError CorsairGetSessionDetails(out _CorsairSessionDetails? details)