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 <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-03-06 10:35:49 +01:00
parent e18bece3df
commit b59b28f716
1 changed files with 1 additions and 2 deletions

View File

@ -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