Squirrel: fix lambda capture for scheduled execute task

Running command as FCVAR_GAMEDLL caused unpredictable behavior.
This commit is contained in:
Kawe Mazidjatari 2022-09-05 23:01:16 +02:00
parent 2887e79bcb
commit 04d4c64107

View File

@ -246,9 +246,9 @@ void Script_Execute(const SQChar* code, SQCONTEXT context)
{
if (!ThreadInMainThread())
{
g_TaskScheduler->Dispatch([code, context]()
const string scode(code);
g_TaskScheduler->Dispatch([scode, context]()
{
string scode(code);
Script_Execute(scode.c_str(), context);
}, 0);