Use weak keys for referring to screens

This commit changes some tables that are used for per-screen stuff to have weak
keys, so that the screens can be garbage-collected, if needed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-04-17 15:37:00 +02:00 committed by Uli Schlachter
parent 0d4cc5f43a
commit fc390ff405
3 changed files with 3 additions and 3 deletions

View File

@ -47,7 +47,7 @@ function layoutbox.new(screen)
-- Do we already have the update callbacks registered?
if boxes == nil then
boxes = setmetatable({}, { __mode = "v" })
boxes = setmetatable({}, { __mode = "kv" })
tag.attached_connect_signal(nil, "property::selected", update_from_tag)
tag.attached_connect_signal(nil, "property::layout", update_from_tag)
layoutbox.boxes = boxes

View File

@ -175,7 +175,7 @@ function taglist.new(screen, filter, buttons, style, update_function, base_widge
end
end
if instances == nil then
instances = {}
instances = setmetatable({}, { __mode = "k" })
local function u(s)
local i = instances[get_screen(s)]
if i then

View File

@ -190,7 +190,7 @@ function tasklist.new(screen, filter, buttons, style, update_function, base_widg
data[c] = nil
end
if instances == nil then
instances = {}
instances = setmetatable({}, { __mode = "k" })
local function us(s)
local i = instances[get_screen(s)]
if i then