2
0
Эх сурвалжийг харах

C#: Synchronize adding ScriptInstances

RedworkDE 2 жил өмнө
parent
commit
8fdebb85ef

+ 4 - 1
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;
 }