diff --git a/lib/wibox/widget/base.lua b/lib/wibox/widget/base.lua index 26203581f..6dbd05da9 100644 --- a/lib/wibox/widget/base.lua +++ b/lib/wibox/widget/base.lua @@ -18,7 +18,7 @@ local base = {} -- {{{ Caches -- Indexes are widgets, allow them to be garbage-collected -local widget_dependencies = setmetatable({}, { __mode = "k" }) +local widget_dependencies = setmetatable({}, { __mode = "kv" }) -- Get the cache of the given kind for this widget. This returns a gears.cache -- that calls the callback of kind `kind` on the widget. diff --git a/tests/test-leaks.lua b/tests/test-leaks.lua index dd36ab9a7..e91727a80 100644 --- a/tests/test-leaks.lua +++ b/tests/test-leaks.lua @@ -10,6 +10,12 @@ local errors = {} local prepare_for_collect = nil +-- Make the layoutbox in the default config GC'able +mywibox[1].visible = false +mywibox = nil +mylayoutbox = nil +awesome.emit_signal("refresh") + -- Test if some objects can be garbage collected local function collectable(a, b, c, d, e, f, g, h, last) assert(last == nil, "got more arguments than supported")