0 may be a valid function, LUA_REFNIL is what we want.
Also don't forget to unref the function on deletion. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
086bada825
commit
d45590fbcc
2
event.c
2
event.c
|
@ -409,7 +409,7 @@ event_handle_keypress(void *data __attribute__ ((unused)),
|
|||
else
|
||||
{
|
||||
keybinding_t *k = keybinding_find(&globalconf.keys, ev);
|
||||
if (k && k->fct)
|
||||
if (k && k->fct != LUA_REFNIL)
|
||||
luaA_dofunction(globalconf.L, k->fct, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ void keybinding_idx_wipe(keybinding_idx_t *idx)
|
|||
|
||||
void keybinding_delete(keybinding_t **kbp)
|
||||
{
|
||||
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, (*kbp)->fct);
|
||||
p_delete(kbp);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue