diff options
author | Michael Wörner <michael.woerner@blickshift.de> | 2024-01-28 11:46:38 +0100 |
---|---|---|
committer | Michael Wörner <michael.woerner@blickshift.de> | 2024-01-28 21:28:14 +0100 |
commit | 9d50a486bf00592888664828b35d703c46eaa9b0 (patch) | |
tree | 1f08063bf8d37055e55d2e2d9f490b6609b1e32b | |
parent | 17e7f85c06366b427e5068c5b3e2940e27ff5f1d (diff) | |
download | redot-engine-9d50a486bf00592888664828b35d703c46eaa9b0.tar.gz |
Fixed ~CSharpScript() holding on to a mutex longer than necessary, creating potential for a deadlock.
-rw-r--r-- | modules/mono/csharp_script.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 33fef2d58c..a84febb226 100644 --- a/modules/mono/csharp_script.cpp +++ b/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) { |