mouse: garbage collector for mouse objects
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
412e074bf8
commit
b2daa2acb3
12
mouse.c
12
mouse.c
|
@ -875,6 +875,17 @@ luaA_mouse_new(lua_State *L)
|
|||
return luaA_mouse_userdata_new(button);
|
||||
}
|
||||
|
||||
/** Handle mouse garbage collection.
|
||||
*/
|
||||
static int
|
||||
luaA_mouse_gc(lua_State *L)
|
||||
{
|
||||
button_t **b = luaA_checkudata(L, 1, "mouse");
|
||||
button_unref(b);
|
||||
*b = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const struct luaL_reg awesome_mouse_methods[] =
|
||||
{
|
||||
{ "new", luaA_mouse_new },
|
||||
|
@ -884,6 +895,7 @@ const struct luaL_reg awesome_mouse_methods[] =
|
|||
};
|
||||
const struct luaL_reg awesome_mouse_meta[] =
|
||||
{
|
||||
{ "__gc", luaA_mouse_gc },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue