Fix crash when using multi-threaded objects spawn and caching scripting VTables

This commit is contained in:
Wojtek Figat
2024-02-10 18:43:15 +01:00
parent 196a4ffe49
commit 46441f6a03

View File

@@ -533,7 +533,12 @@ void ScriptingType::HackObjectVTable(void* object, ScriptingTypeHandle baseTypeH
if (!Script.VTable)
{
// Ensure to have valid Script VTable hacked
SetupScriptObjectVTable(object, baseTypeHandle, wrapperIndex);
BinaryModule::Locker.Lock();
if (!Script.VTable)
{
SetupScriptObjectVTable(object, baseTypeHandle, wrapperIndex);
}
BinaryModule::Locker.Unlock();
}
// Override object vtable with hacked one that has calls to overriden scripting functions