mirror of
https://github.com/odrling/Aegisub
synced 2025-04-11 22:56:02 +02:00
lua: Don't check_stack in LuaCheckStack destructor
This would cause an assertion failure in functions like lua_for_each when the given closure throws an error and thus leaves some values on the stack. This can make Aegisub crash entirely instead of just catching and reporting the error. Instead, these stack_checks can be done manually.
This commit is contained in:
parent
79050dfdfb
commit
42f7e53e92
@ -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 {
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user