diff --git a/libaegisub/include/libaegisub/lua/utils.h b/libaegisub/include/libaegisub/lua/utils.h index c5a65d6e4..cf55e3f4d 100644 --- a/libaegisub/include/libaegisub/lua/utils.h +++ b/libaegisub/include/libaegisub/lua/utils.h @@ -129,7 +129,6 @@ struct LuaStackcheck { void dump(); LuaStackcheck(lua_State *L) : L(L), startstack(lua_gettop(L)) { } - ~LuaStackcheck() { check_stack(0); } }; #else struct LuaStackcheck { diff --git a/src/auto4_lua.cpp b/src/auto4_lua.cpp index 36156288b..370a791e3 100644 --- a/src/auto4_lua.cpp +++ b/src/auto4_lua.cpp @@ -680,6 +680,7 @@ namespace { if (lua_isnumber(L, -1) && lua_tointeger(L, -1) == 3) { lua_pop(L, 1); // just to avoid tripping the stackcheck in debug description = "Attempted to load an Automation 3 script as an Automation 4 Lua script. Automation 3 is no longer supported."; + stackcheck.check_stack(0); return; } @@ -692,6 +693,7 @@ namespace { name = GetPrettyFilename().string(); lua_pop(L, 1); + stackcheck.check_stack(0); // if we got this far, the script should be ready loaded = true; }