C#: Synchronize adding ScriptInstances

(cherry picked from commit 8fdebb85ef)
This commit is contained in:
RedworkDE 2023-06-29 16:03:22 +02:00 committed by Yuri Sizov
parent 980d95a3ad
commit f05e3712d6
1 changed files with 4 additions and 1 deletions

View File

@ -1532,7 +1532,10 @@ CSharpInstance *CSharpInstance::create_for_managed_type(Object *p_owner, CSharpS
instance->_reference_owner_unsafe();
}
p_script->instances.insert(p_owner);
{
MutexLock lock(CSharpLanguage::get_singleton()->get_script_instances_mutex());
p_script->instances.insert(p_owner);
}
return instance;
}