layoutlist: Use weak tables to store the cache.

This commit is contained in:
Emmanuel Lepage Vallee 2019-08-07 02:33:07 -04:00
parent c4c97174e6
commit d832b8c9b8
1 changed files with 2 additions and 2 deletions

View File

@ -327,7 +327,7 @@ function layoutlist:set_widget_template(widget_template)
self._private.widget_template = widget_template
-- Remove the existing instances
self._private.data = {}
self._private.data = setmetatable({}, { __mode = 'k' })
-- Prevent a race condition when the constructor loop to initialize the
-- arguments.
@ -403,7 +403,7 @@ local function new(_, args)
ret._private.style = args.style or {}
ret._private.buttons = args.buttons
ret._private.source = args.source
ret._private.data = {}
ret._private.data = setmetatable({}, { __mode = 'k' })
reload_cache(ret)