Skip to content

Commit

Permalink
Merge pull request #87669 from bs-mwoerner/csharp_deadlock
Browse files Browse the repository at this point in the history
Fix possible deadlock when creating scripts during a background garbage collection
  • Loading branch information
akien-mga committed Jan 29, 2024
2 parents 5c61803 + 9d50a48 commit f0144d7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/mono/csharp_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f0144d7

Please sign in to comment.