1 - The line with type.BaseType == typeof(MulticastDelegate) was unneeded as I understand. _CSCastMap will already have a caster for this type. Removing it also allows register_type_caster<Delegate> to work.
2 - Allows register_type_caster<object>. This type caster will be ignored at first and used at the end as a fallback in the js_push_var.
3 - Reverted WeakRef changes to DynamicDelegateMethod. This change was causing C# delegates to be GCed early. I think it is ok if QuickJS holds on to C# delegates until it is disposed. I am not sure of the side effects of this change. But with this PR, I don't have GC leak in my code anymore.
1 - The line with
type.BaseType == typeof(MulticastDelegate)
was unneeded as I understand._CSCastMap
will already have a caster for this type. Removing it also allowsregister_type_caster<Delegate>
to work. 2 - Allowsregister_type_caster<object>
. This type caster will be ignored at first and used at the end as a fallback in thejs_push_var
. 3 - RevertedWeakRef
changes toDynamicDelegateMethod
. This change was causing C# delegates to be GCed early. I think it is ok if QuickJS holds on to C# delegates until it is disposed. I am not sure of the side effects of this change. But with this PR, I don't have GC leak in my code anymore.