Sfoglia il codice sorgente

Merge pull request #78157 from RedworkDE/net-shutting-down-abruptly

C#: Fix crash with `DisposablesTracker_OnGodotShuttingDown`
Rémi Verschelde 1 anno fa
parent
commit
6afd320984
2 ha cambiato i file con 4 aggiunte e 6 eliminazioni
  1. 4 0
      modules/mono/csharp_script.cpp
  2. 0 6
      modules/mono/mono_gd/gd_mono.cpp

+ 4 - 0
modules/mono/csharp_script.cpp

@@ -142,6 +142,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

+ 0 - 6
modules/mono/mono_gd/gd_mono.cpp

@@ -556,12 +556,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);
 	}