luaa: fix memory leak in __gc
We need to wipe the ref_array. Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
3849e6d747
commit
43902aed69
1
button.c
1
button.c
|
@ -40,6 +40,7 @@ static int
|
||||||
luaA_button_gc(lua_State *L)
|
luaA_button_gc(lua_State *L)
|
||||||
{
|
{
|
||||||
button_t *button = luaL_checkudata(L, 1, "button");
|
button_t *button = luaL_checkudata(L, 1, "button");
|
||||||
|
luaA_ref_array_wipe(&button->refs);
|
||||||
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, button->press);
|
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, button->press);
|
||||||
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, button->release);
|
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, button->release);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
1
client.c
1
client.c
|
@ -51,6 +51,7 @@ static int
|
||||||
luaA_client_gc(lua_State *L)
|
luaA_client_gc(lua_State *L)
|
||||||
{
|
{
|
||||||
client_t *c = luaL_checkudata(L, 1, "client");
|
client_t *c = luaL_checkudata(L, 1, "client");
|
||||||
|
luaA_ref_array_wipe(&c->refs);
|
||||||
button_array_wipe(&c->buttons);
|
button_array_wipe(&c->buttons);
|
||||||
image_unref(L, c->icon);
|
image_unref(L, c->icon);
|
||||||
p_delete(&c->class);
|
p_delete(&c->class);
|
||||||
|
|
1
image.c
1
image.c
|
@ -28,6 +28,7 @@ static int
|
||||||
luaA_image_gc(lua_State *L)
|
luaA_image_gc(lua_State *L)
|
||||||
{
|
{
|
||||||
image_t *p = luaL_checkudata(L, 1, "image");
|
image_t *p = luaL_checkudata(L, 1, "image");
|
||||||
|
luaA_ref_array_wipe(&p->refs);
|
||||||
imlib_context_set_image(p->image);
|
imlib_context_set_image(p->image);
|
||||||
imlib_free_image();
|
imlib_free_image();
|
||||||
p_delete(&p->data);
|
p_delete(&p->data);
|
||||||
|
|
1
key.c
1
key.c
|
@ -50,6 +50,7 @@ static int
|
||||||
luaA_key_gc(lua_State *L)
|
luaA_key_gc(lua_State *L)
|
||||||
{
|
{
|
||||||
keyb_t *kbp = luaL_checkudata(L, 1, "key");
|
keyb_t *kbp = luaL_checkudata(L, 1, "key");
|
||||||
|
luaA_ref_array_wipe(&kbp->refs);
|
||||||
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, kbp->press);
|
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, kbp->press);
|
||||||
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, kbp->release);
|
luaL_unref(globalconf.L, LUA_REGISTRYINDEX, kbp->release);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
1
tag.c
1
tag.c
|
@ -41,6 +41,7 @@ static int
|
||||||
luaA_tag_gc(lua_State *L)
|
luaA_tag_gc(lua_State *L)
|
||||||
{
|
{
|
||||||
tag_t *tag = luaL_checkudata(L, 1, "tag");
|
tag_t *tag = luaL_checkudata(L, 1, "tag");
|
||||||
|
luaA_ref_array_wipe(&tag->refs);
|
||||||
client_array_wipe(&tag->clients);
|
client_array_wipe(&tag->clients);
|
||||||
p_delete(&tag->name);
|
p_delete(&tag->name);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
1
wibox.c
1
wibox.c
|
@ -39,6 +39,7 @@ static int
|
||||||
luaA_wibox_gc(lua_State *L)
|
luaA_wibox_gc(lua_State *L)
|
||||||
{
|
{
|
||||||
wibox_t *wibox = luaL_checkudata(L, 1, "wibox");
|
wibox_t *wibox = luaL_checkudata(L, 1, "wibox");
|
||||||
|
luaA_ref_array_wipe(&wibox->refs);
|
||||||
p_delete(&wibox->cursor);
|
p_delete(&wibox->cursor);
|
||||||
simplewindow_wipe(&wibox->sw);
|
simplewindow_wipe(&wibox->sw);
|
||||||
button_array_wipe(&wibox->buttons);
|
button_array_wipe(&wibox->buttons);
|
||||||
|
|
1
widget.c
1
widget.c
|
@ -44,6 +44,7 @@ static int
|
||||||
luaA_widget_gc(lua_State *L)
|
luaA_widget_gc(lua_State *L)
|
||||||
{
|
{
|
||||||
widget_t *widget = luaL_checkudata(L, 1, "widget");
|
widget_t *widget = luaL_checkudata(L, 1, "widget");
|
||||||
|
luaA_ref_array_wipe(&widget->refs);
|
||||||
if(widget->destructor)
|
if(widget->destructor)
|
||||||
widget->destructor(widget);
|
widget->destructor(widget);
|
||||||
button_array_wipe(&widget->buttons);
|
button_array_wipe(&widget->buttons);
|
||||||
|
|
Loading…
Reference in New Issue