summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-08-21 09:12:52 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-08-21 09:12:52 -0400
commitf4b650b100c120ed99208545864b0a7f36ce058d (patch)
tree327185a83a2a5940c1ba6d73d57ca69710ec37b3
parent409745eb370d7609df70da81584142dffbfe9d3f (diff)
Suppress ~LuaStackDelta() verification during stack unwinding.
Otherwise, an exception raised in the block containing a LuaStackDelta instance -- that might be caught -- would result in an LL_ERRS() crash. We can't expect a block exited via exception to keep its contract wrt the Lua data stack.
-rw-r--r--indra/llcommon/lua_function.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/indra/llcommon/lua_function.cpp b/indra/llcommon/lua_function.cpp
index ad77a1e040..1e9bbdd651 100644
--- a/indra/llcommon/lua_function.cpp
+++ b/indra/llcommon/lua_function.cpp
@@ -1056,7 +1056,10 @@ LuaStackDelta::LuaStackDelta(lua_State* L, const std::string& where, int delta):
LuaStackDelta::~LuaStackDelta()
{
auto depth{ lua_gettop(L) };
- if (mDepth + mDelta != depth)
+ // If we're unwinding the stack due to an exception, then of course we
+ // can't expect the logic in the block containing this LuaStackDelta
+ // instance to keep its contract wrt the Lua data stack.
+ if (std::uncaught_exceptions() == 0 && mDepth + mDelta != depth)
{
LL_ERRS("Lua") << mWhere << ": Lua stack went from " << mDepth << " to " << depth;
if (mDelta)