mirror of
https://github.com/DarthAffe/RGB.NET.git
synced 2026-11-11 04:57:15 +00:00
Wooting - Fixed race condition during SDK load/unload
This commit is contained in:
1 parent
63498eb8c3
commit
41f9d82edc
3 files changed
+43
-22
No files matched your search
@@ -16,6 +16,7 @@ namespace RGB.NET.Devices.Wooting.Native
|
||||
#region Library management
|
||||
|
||||
private static IntPtr _dllHandle = IntPtr.Zero;
|
||||
internal static object SdkLock = new();
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the SDK.
|
||||
@@ -52,6 +53,16 @@ namespace RGB.NET.Devices.Wooting.Native
|
||||
{
|
||||
if (_dllHandle == IntPtr.Zero) return;
|
||||
|
||||
Reset();
|
||||
Close();
|
||||
|
||||
_getDeviceInfoPointer = null;
|
||||
_keyboardConnectedPointer = null;
|
||||
_arrayUpdateKeyboardPointer = null;
|
||||
_arraySetSinglePointer = null;
|
||||
_resetPointer = null;
|
||||
_closePointer = null;
|
||||
|
||||
// ReSharper disable once EmptyEmbeddedStatement - DarthAffe 20.02.2016: We might need to reduce the internal reference counter more than once to set the library free
|
||||
while (FreeLibrary(_dllHandle)) ;
|
||||
_dllHandle = IntPtr.Zero;
|
||||
@@ -116,3 +127,4 @@ namespace RGB.NET.Devices.Wooting.Native
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user