Преглед изворни кода

Merge pull request #87669 from bs-mwoerner/csharp_deadlock

Fix possible deadlock when creating scripts during a background garbage collection
Rémi Verschelde пре 1 година
родитељ
комит
f0144d7f45
1 измењених фајлова са 5 додато и 3 уклоњено
  1. 5 3
      modules/mono/csharp_script.cpp

+ 5 - 3
modules/mono/csharp_script.cpp

@@ -2855,15 +2855,17 @@ CSharpScript::CSharpScript() {
 #ifdef DEBUG_ENABLED
 	{
 		MutexLock lock(CSharpLanguage::get_singleton()->script_instances_mutex);
-		CSharpLanguage::get_singleton()->script_list.add(&this->script_list);
+		CSharpLanguage::get_singleton()->script_list.add(&script_list);
 	}
 #endif
 }
 
 CSharpScript::~CSharpScript() {
 #ifdef DEBUG_ENABLED
-	MutexLock lock(CSharpLanguage::get_singleton()->script_instances_mutex);
-	CSharpLanguage::get_singleton()->script_list.remove(&this->script_list);
+	{
+		MutexLock lock(CSharpLanguage::get_singleton()->script_instances_mutex);
+		CSharpLanguage::get_singleton()->script_list.remove(&script_list);
+	}
 #endif
 
 	if (GDMonoCache::godot_api_cache_updated) {