mouse: fix button delete

We need to unref Lua functions.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-10-24 18:53:47 +02:00
parent 0b5a681171
commit 4f1273794b
2 changed files with 15 additions and 1 deletions

11
mouse.c
View File

@ -70,6 +70,17 @@ a_strtocorner(const char *str, size_t len)
} }
} }
/** Delete a button.
* \param button The button to destroy.
*/
void
button_delete(button_t **button)
{
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, (*button)->press);
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, (*button)->release);
p_delete(button);
}
/** Snap an area to the outside of an area. /** Snap an area to the outside of an area.
* \param geometry geometry of the area to snap * \param geometry geometry of the area to snap
* \param snap_geometry geometry of snapping area * \param snap_geometry geometry of snapping area

View File

@ -115,7 +115,10 @@ struct button_t
/** Lua function to execute on release. */ /** Lua function to execute on release. */
luaA_ref release; luaA_ref release;
}; };
DO_RCNT(button_t, button, p_delete)
void button_delete(button_t **button);
DO_RCNT(button_t, button, button_delete)
DO_ARRAY(button_t *, button, button_unref) DO_ARRAY(button_t *, button, button_unref)
/** Widget */ /** Widget */