layoutbox: Fix a leak with Lua 5.1 and luajit

Fixes #808
This commit is contained in:
Emmanuel Lepage Vallee 2016-05-08 00:20:51 -04:00
parent df6bc2f6bc
commit 25f4f24791
1 changed files with 4 additions and 5 deletions

View File

@ -8,10 +8,9 @@
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
local setmetatable = setmetatable local setmetatable = setmetatable
local capi = { screen = screen } local capi = { screen = screen, tag = tag }
local layout = require("awful.layout") local layout = require("awful.layout")
local tooltip = require("awful.tooltip") local tooltip = require("awful.tooltip")
local tag = require("awful.tag")
local beautiful = require("beautiful") local beautiful = require("beautiful")
local imagebox = require("wibox.widget.imagebox") local imagebox = require("wibox.widget.imagebox")
@ -48,8 +47,8 @@ function layoutbox.new(screen)
-- Do we already have the update callbacks registered? -- Do we already have the update callbacks registered?
if boxes == nil then if boxes == nil then
boxes = setmetatable({}, { __mode = "kv" }) boxes = setmetatable({}, { __mode = "kv" })
tag.attached_connect_signal(nil, "property::selected", update_from_tag) capi.tag.connect_signal("property::selected", update_from_tag)
tag.attached_connect_signal(nil, "property::layout", update_from_tag) capi.tag.connect_signal("property::layout", update_from_tag)
layoutbox.boxes = boxes layoutbox.boxes = boxes
end end
@ -60,7 +59,7 @@ function layoutbox.new(screen)
w._layoutbox_tooltip = tooltip({ objects = {w}, delay_show = 1 }) w._layoutbox_tooltip = tooltip({ objects = {w}, delay_show = 1 })
update(w, screen) update(w, screen)
boxes[screen] = w boxes[screen] = setmetatable({}, {__index = w, __newindex = w})
end end
return w return w