summaryrefslogtreecommitdiffstats
path: root/modules/mono/csharp_script.cpp
diff options
context:
space:
mode:
authorRedworkDE <10944644+RedworkDE@users.noreply.github.com>2023-03-21 17:14:29 +0100
committerRedworkDE <10944644+RedworkDE@users.noreply.github.com>2023-05-22 21:40:14 +0200
commit8fdebb85ef180c1e31e023c6b1a51cea683270a1 (patch)
treeb8ccf2da6b8cf70594e35675fdeac83d2157e824 /modules/mono/csharp_script.cpp
parent903dda8337b7766924854fb64726496e7d27cde1 (diff)
downloadredot-engine-8fdebb85ef180c1e31e023c6b1a51cea683270a1.tar.gz
C#: Synchronize adding ScriptInstances
Diffstat (limited to 'modules/mono/csharp_script.cpp')
-rw-r--r--modules/mono/csharp_script.cpp5
1 files changed, 4 insertions, 1 deletions
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;
}