Skip to content

Commit

Permalink
Fixed ~CSharpScript() holding on to a mutex longer than necessary, cr…
Browse files Browse the repository at this point in the history
…eating potential for a deadlock.
  • Loading branch information
bs-mwoerner committed Jan 28, 2024
1 parent 17e7f85 commit 9d50a48
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 9d50a48

Please sign in to comment.