Prevent Binary Operation functions from being garbage collected
This commit is contained in:
parent
e44432c068
commit
c3f1a00750
|
@ -15,6 +15,8 @@ namespace PorygonSharp.UserData
|
|||
public Type Type { get; }
|
||||
private readonly Dictionary<Type, MethodInfo> _implicitCasts;
|
||||
private readonly Dictionary<Type, MethodInfo> _explicitCasts;
|
||||
// ReSharper disable once CollectionNeverQueried.Local
|
||||
private readonly List<UserDataBinaryOperation> _binaryOperations = new List<UserDataBinaryOperation>();
|
||||
|
||||
private delegate bool IsCastableDelegate(IntPtr scriptType, bool isExplicit);
|
||||
private delegate IntPtr CastDelegate(IntPtr obj, IntPtr scriptType);
|
||||
|
@ -216,6 +218,7 @@ namespace PorygonSharp.UserData
|
|||
{
|
||||
var operation = UserDataBinaryOperation.Create(info);
|
||||
AddUserdataBinaryOperation(Id, (byte)kind, operation.Handle);
|
||||
_binaryOperations.Add(operation);
|
||||
}
|
||||
|
||||
[DllImport("PorygonLang", EntryPoint = "RegisterUserDataField", CallingConvention = CallingConvention.Cdecl)]
|
||||
|
|
Loading…
Reference in New Issue