diff --git a/src/BizHawk.BizInvoke/CallingConventionAdapter.cs b/src/BizHawk.BizInvoke/CallingConventionAdapter.cs index 5770ca6d91..e85363effb 100644 --- a/src/BizHawk.BizInvoke/CallingConventionAdapter.cs +++ b/src/BizHawk.BizInvoke/CallingConventionAdapter.cs @@ -154,11 +154,11 @@ namespace BizHawk.BizInvoke throw new InvalidOperationException("Out of Thunk memory"); } - private int FindUsedIndex(object o) + private int FindUsedIndex(object lifetime) { for (int i = 0; i < _refs.Length; i++) { - if (_refs[i] == o) + if (_refs[i]?.Target == lifetime) return i; } return -1;