You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
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.
This commit is contained in:
@@ -471,26 +471,17 @@ GDMono::GDMono() {
|
||||
}
|
||||
|
||||
GDMono::~GDMono() {
|
||||
finalizing_scripts_domain = true;
|
||||
|
||||
if (is_runtime_initialized()) {
|
||||
#warning "TODO assembly unloading for cleanup of disposables (including managed RefCounteds)"
|
||||
#if 0
|
||||
if (scripts_domain) {
|
||||
Error err = _unload_scripts_domain();
|
||||
if (err != OK) {
|
||||
ERR_PRINT("Mono: Failed to unload scripts domain.");
|
||||
}
|
||||
if (GDMonoCache::godot_api_cache_updated) {
|
||||
GDMonoCache::managed_callbacks.DisposablesTracker_OnGodotShuttingDown();
|
||||
}
|
||||
|
||||
print_verbose("Mono: Runtime cleanup...");
|
||||
|
||||
mono_jit_cleanup(root_domain);
|
||||
|
||||
print_verbose("Mono: Finalized");
|
||||
#endif
|
||||
|
||||
runtime_initialized = false;
|
||||
}
|
||||
|
||||
finalizing_scripts_domain = false;
|
||||
runtime_initialized = false;
|
||||
|
||||
#if defined(ANDROID_ENABLED)
|
||||
gdmono::android::support::cleanup();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user