mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-07-23 21:38:22 +00:00
Fixed crashes from callbacks.
This commit is contained in:
parent
d1fb2597bb
commit
9183e3ae0d
|
@ -1,5 +1,6 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace OpenTK.Platform.MacOS
|
namespace OpenTK.Platform.MacOS
|
||||||
{
|
{
|
||||||
|
@ -40,6 +41,8 @@ namespace OpenTK.Platform.MacOS
|
||||||
objc_registerClassPair(handle);
|
objc_registerClassPair(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static List<Delegate> storedDelegates = new List<Delegate>();
|
||||||
|
|
||||||
public static void RegisterMethod(IntPtr handle, Delegate d, string selector, string typeString)
|
public static void RegisterMethod(IntPtr handle, Delegate d, string selector, string typeString)
|
||||||
{
|
{
|
||||||
// TypeString info:
|
// TypeString info:
|
||||||
|
@ -52,6 +55,8 @@ namespace OpenTK.Platform.MacOS
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Could not register method " + d + " in class + " + class_getName(handle));
|
throw new ArgumentException("Could not register method " + d + " in class + " + class_getName(handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
storedDelegates.Add(d); // Don't let the garbage collector eat our delegates.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue