diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-08-20 21:12:25 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-08-20 21:12:25 -0400 |
commit | 376c890c095fbc59b83402255cc1036c411150b9 (patch) | |
tree | 7c15346acb6121e5a3312ffe945f4a419f849307 /indra/llui/lluiusage.cpp | |
parent | 68313aa2defcc7d6e5ebbd96344d78f3a31fdb9a (diff) |
Fix for #2237: intermittent Lua data stack overflow.
Use a static unordered_map to allow a function receiving (lua_State* L) to
look up the LuaState instance managing that lua_State. We've thought about
this from time to time already. LuaState's constructor creates the map entry;
its destructor removes it; the new static getParent(lua_State* L) method
performs the lookup.
Migrate lluau::set_interrupts_counter() and check_interrupts_counter() into
LuaState member functions. Add a new mInterrupts counter for them.
Importantly, LuaState::check_interrupts_counter(), which is indirectly called
by a lua_callbacks().interrupt function, no longer performs any Lua stack
operations. Empirically, it seems the Lua engine is capable of interrupting
itself at a moment when re-entry confuses it.
Change previous lluau::set_interrupts_counter(L, 0) calls to
LuaState::getParent(L).set_interrupts_counter(0).
Also add LuaStackDelta class, and a lua_checkdelta() helper macro, to verify
that the Lua data stack depth on exit from a block differs from the depth on
entry by exactly the expected amount. Sprinkle lua_checkdelta() macros in
likely places.
Diffstat (limited to 'indra/llui/lluiusage.cpp')
0 files changed, 0 insertions, 0 deletions