Scripting: Fix early freeing of coerced list contents (fixes #2881)

This commit is contained in:
Vicki Pfau 2023-04-11 16:26:17 -07:00
parent 3f108aae75
commit 1b85fb3de5
1 changed files with 8 additions and 0 deletions

View File

@ -630,6 +630,14 @@ struct mScriptValue* _luaCoerceTable(struct mScriptEngineContextLua* luaContext,
mScriptValueDeref(list);
return table;
}
for (i = 0; i < mScriptListSize(list->value.list); ++i) {
struct mScriptValue* value = mScriptListGetPointer(list->value.list, i);
if (value->type->base != mSCRIPT_TYPE_WRAPPER) {
continue;
}
value = mScriptValueUnwrap(value);
mScriptValueRef(value);
}
mScriptValueDeref(table);
return list;
}