Correctly unref widget_nodes
While drawing the wibox, the C core builds up a list of widgets and their associated geometry. This list consists of widget_node_t objects and is constructed like this (This is from luaA_table2widgets()): widget_node_t w; p_clear(&w, 1); w.widget = luaA_object_ref_item(L, idx, -1); widget_node_array_append(widgets, w); After we are done with this list of widget nodes, it is freed via wibox_widget_node_array_wipe(). However, wibox_widget_node_array_wipe() passed "&w" to luaA_object_unref_item() while it should have used "w.widget" (which is what was returned from luaA_object_ref_item()). This made the unref fail and the wibox was carrying around a reference to this widget forever. This was effectively a memory leak. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
222fb4c9c5
commit
8c0a83f5ca
2
wibox.c
2
wibox.c
|
@ -58,7 +58,7 @@ wibox_widget_node_array_wipe(lua_State *L, int idx)
|
|||
{
|
||||
wibox_t *wibox = luaA_checkudata(L, idx, &wibox_class);
|
||||
foreach(widget_node, wibox->widgets)
|
||||
luaA_object_unref_item(globalconf.L, idx, widget_node);
|
||||
luaA_object_unref_item(globalconf.L, idx, widget_node->widget);
|
||||
widget_node_array_wipe(&wibox->widgets);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue