Merge pull request #87669 from bs-mwoerner/csharp_deadlock

Fix possible deadlock when creating scripts during a background garbage collection
This commit is contained in:
Rémi Verschelde 2024-01-29 13:17:56 +01:00
commit f0144d7f45
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 5 additions and 3 deletions

View File

@ -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) {