From b59b28f7161420371a4aa54915428327eb03395f Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 6 Mar 2016 10:35:49 +0100 Subject: [PATCH] Fix error handling in the keygrabber We called the keygrabber and told Lua we are expecting one return value, so Lua will always get us one return value on the Lua stack. However, when an error happens, nothing is pushed on the stack, but we still tried to pop the return value. This corrupted the Lua stack. The easiest fix is to just not ask for a return value that is not used anyway. Not adding a test for this, because the test has to cause a Lua error which the C code will then log to stderr and the test runner considers this a test failure... Fixes: https://github.com/awesomeWM/awesome/issues/735 Signed-off-by: Uli Schlachter --- event.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/event.c b/event.c index f650d52b..fc9f478a 100644 --- a/event.c +++ b/event.c @@ -660,12 +660,11 @@ event_handle_key(xcb_key_press_event_t *ev) { lua_rawgeti(L, LUA_REGISTRYINDEX, globalconf.keygrabber); - if(!luaA_dofunction(L, 3, 1)) + if(!luaA_dofunction(L, 3, 0)) { warn("Stopping keygrabber."); luaA_keygrabber_stop(L); } - lua_pop(L, 1); } } else