one more protection against Lua stack leak
This commit is contained in:
parent
92fe487349
commit
c12ba48a63
12
src/lua.c
12
src/lua.c
|
@ -765,7 +765,7 @@ static void big_picture_menu (void) {
|
|||
static int is_current_definition(lua_State *L, const char *definition_name, int current_history_array_index, int history_array_location, int history_array_size) {
|
||||
/* Sequentially scan back through history_array until current_history_array_index.
|
||||
* Is there an earlier definition of definition_name? */
|
||||
//? int oldsize = L->top-L->stack;
|
||||
int oldtop = lua_gettop(L);
|
||||
int found = 0;
|
||||
for (int i = history_array_size; i > current_history_array_index; --i) {
|
||||
lua_rawgeti(L, history_array_location, i);
|
||||
|
@ -784,11 +784,11 @@ static int is_current_definition(lua_State *L, const char *definition_name, int
|
|||
if (found)
|
||||
break;
|
||||
}
|
||||
//? if(oldsize != L->top-L->stack) {
|
||||
//? endwin();
|
||||
//? printf("%d %d\n", oldsize, L->top-L->stack);
|
||||
//? exit(1);
|
||||
//? }
|
||||
if(oldtop != lua_gettop(L)) {
|
||||
endwin();
|
||||
printf("%d %d\n", oldtop, lua_gettop(L));
|
||||
exit(1);
|
||||
}
|
||||
return !found;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue