fix(lua): fix script array iterator being potentially invalidated while iterating due to new scripts that could be added and the vector getting reallocated due to it. (#1883)

This commit is contained in:
Quentin 2023-07-29 11:22:04 +02:00 committed by GitHub
parent ae97322ece
commit 0e0b4d46a4

View File

@ -231,8 +231,11 @@ namespace big
{
std::lock_guard guard(m_registered_scripts_mutex);
for (auto& script : m_registered_scripts)
const auto script_count = m_registered_scripts.size();
for (size_t i = 0; i < script_count; i++)
{
const auto script = m_registered_scripts[i].get();
if (script->is_enabled())
{
script->tick();