Revert "stop leaking on the Lua stack"

This reverts commit 7c1b9d0b91.

The 'big hammer' isn't good enough. The recent changes view seems to
need state on the stack across invocations of the editor.
This commit is contained in:
Kartik K. Agaram 2021-12-16 04:02:37 -08:00
parent 68e008526a
commit 76ed8d30f4
2 changed files with 2 additions and 3 deletions

View File

@ -1080,7 +1080,6 @@ static int Quit = 0;
static int Back_to_big_picture = 0;
extern void save_editor_state(int rowoff, int coloff, int cy, int cx);
static void editorProcessKeypress(lua_State* L) {
lua_settop(L, 0); /* big hammer to avoid overflowing the stack */
int c = getch();
//? mvprintw(LINES-3, 60, "key: %d\n", c);
//? getch();

View File

@ -901,10 +901,10 @@ int restore_editor_view (lua_State *L) {
status = load_editor_buffer_to_current_definition_in_image(L);
if (status == 0 || lua_isnil(L, -1))
break;
Previous_error = strdup(lua_tostring(L, -1)); /* memory leak */
Previous_error = lua_tostring(L, -1);
if (Previous_error == NULL) Previous_error = "(error object is not a string)";
lua_pop(L, 1);
back_to_big_picture = resumeEdit(L);
lua_pop(L, 1);
}
return back_to_big_picture;
}