From f4b650b100c120ed99208545864b0a7f36ce058d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 21 Aug 2024 09:12:52 -0400 Subject: 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. --- indra/llcommon/lua_function.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3