Ver Fonte

Fixed ~CSharpScript() holding on to a mutex longer than necessary, creating potential for a deadlock.

Michael Wörner há 1 ano atrás
pai
commit
9d50a486bf
1 ficheiros alterados com 5 adições e 3 exclusões
  1. 5 3
      modules/mono/csharp_script.cpp

+ 5 - 3
modules/mono/csharp_script.cpp

@@ -2855,15 +2855,17 @@ CSharpScript::CSharpScript() {
 #ifdef DEBUG_ENABLED
 #ifdef DEBUG_ENABLED
 	{
 	{
 		MutexLock lock(CSharpLanguage::get_singleton()->script_instances_mutex);
 		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
 #endif
 }
 }
 
 
 CSharpScript::~CSharpScript() {
 CSharpScript::~CSharpScript() {
 #ifdef DEBUG_ENABLED
 #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
 #endif
 
 
 	if (GDMonoCache::godot_api_cache_updated) {
 	if (GDMonoCache::godot_api_cache_updated) {