diff options
author | Ignacio Roldán Etcheverry <ignalfonsore@gmail.com> | 2021-12-28 23:25:16 +0100 |
---|---|---|
committer | Ignacio Roldán Etcheverry <ignalfonsore@gmail.com> | 2022-08-22 03:36:51 +0200 |
commit | f88d8902cfc0d6a9441e794eb47611ef4ed0d46c (patch) | |
tree | 98dc44db6bc821c1aa9785229e5d9f58e6b5967a /modules/mono/csharp_script.cpp | |
parent | 4d710bf659c0bea5b8f3d6ec65eda047bada0e02 (diff) |
C#: Ensure native handles are freed after switch to .NET Core
Finalizers are longer guaranteed to be called on exit now that
we switched to .NET Core. This results in native instances leaking.
The only solution I can think of so far is to keep a list of all
instances alive to dispose when the AssemblyLoadContext.Unloading
event is raised.
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r-- | modules/mono/csharp_script.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 80e127bbc2..52b0e82c6e 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -1581,6 +1581,7 @@ void CSharpLanguage::tie_managed_to_unmanaged_with_pre_setup(GCHandleIntPtr p_gc CSharpInstance *instance = CAST_CSHARP_INSTANCE(p_unmanaged->get_script_instance()); if (!instance) { + // Native bindings don't need post-setup return; } |