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

(cherry picked from commit 9d50a486bf)
This commit is contained in:
Michael Wörner 2024-01-28 11:46:38 +01:00 committed by Rémi Verschelde
parent 587d689c5f
commit 167b4c071c
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -2819,15 +2819,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) {