From 8fdebb85ef180c1e31e023c6b1a51cea683270a1 Mon Sep 17 00:00:00 2001 From: RedworkDE <10944644+RedworkDE@users.noreply.github.com> Date: Tue, 21 Mar 2023 17:14:29 +0100 Subject: C#: Synchronize adding ScriptInstances --- modules/mono/csharp_script.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'modules/mono/csharp_script.cpp') diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index a12cac5a99..709e6d5fae 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -1533,7 +1533,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; } -- cgit v1.2.3