fix: crash on windows
parent
5caebf2b34
commit
9fa6841266
|
@ -40,6 +40,8 @@ namespace SkyHook
|
|||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
public static readonly UnityEvent<SkyHookEvent> KeyUpdated = new();
|
||||
|
||||
private SkyHookNative.Callback _callback;
|
||||
|
||||
/// <summary>
|
||||
/// The instance of <see cref="SkyHookManager"/>.
|
||||
/// A new instance will be created if it does not exist.
|
||||
|
@ -85,7 +87,9 @@ namespace SkyHook
|
|||
{
|
||||
try
|
||||
{
|
||||
var result = SkyHookNative.StartHook(HookCallback);
|
||||
_callback = HookCallback;
|
||||
|
||||
var result = SkyHookNative.StartHook(_callback);
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
|
@ -96,14 +100,20 @@ namespace SkyHook
|
|||
started = true;
|
||||
|
||||
_mre.WaitOne();
|
||||
|
||||
Debug.Log("Thread ended");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
exception = e;
|
||||
Debug.LogError(e);
|
||||
throw;
|
||||
}
|
||||
}).Start();
|
||||
|
||||
isHookActive = true;
|
||||
started = true;
|
||||
|
||||
while (!started && exception == null)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace SkyHook
|
|||
/// <summary>
|
||||
/// The native callback handled by <see cref="SkyHookManager"/>.
|
||||
/// </summary>
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||
public delegate void Callback(SkyHookEvent ev);
|
||||
|
||||
private const string Lib = "skyhook";
|
||||
|
|
Reference in New Issue