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:
parent
b48c256954
commit
c54be57469
@ -231,8 +231,11 @@ namespace big
|
|||||||
{
|
{
|
||||||
std::lock_guard guard(m_registered_scripts_mutex);
|
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())
|
if (script->is_enabled())
|
||||||
{
|
{
|
||||||
script->tick();
|
script->tick();
|
||||||
|
Reference in New Issue
Block a user