Skip to content

Commit

Permalink
C#: Fix crash with DisposablesTracker_OnGodotShuttingDown
Browse files Browse the repository at this point in the history
  • Loading branch information
RedworkDE committed Jun 13, 2023
1 parent a3c49ad commit d515fcc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 4 additions & 0 deletions modules/mono/csharp_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ void CSharpLanguage::finalize() {
return;
}

if (gdmono && gdmono->is_runtime_initialized() && GDMonoCache::godot_api_cache_updated) {
GDMonoCache::managed_callbacks.DisposablesTracker_OnGodotShuttingDown();
}

finalizing = true;

// Make sure all script binding gchandles are released before finalizing GDMono
Expand Down
6 changes: 0 additions & 6 deletions modules/mono/mono_gd/gd_mono.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,12 +534,6 @@ GDMono::GDMono() {
GDMono::~GDMono() {
finalizing_scripts_domain = true;

if (is_runtime_initialized()) {
if (GDMonoCache::godot_api_cache_updated) {
GDMonoCache::managed_callbacks.DisposablesTracker_OnGodotShuttingDown();
}
}

if (hostfxr_dll_handle) {
OS::get_singleton()->close_dynamic_library(hostfxr_dll_handle);
}
Expand Down

0 comments on commit d515fcc

Please sign in to comment.