notification: Correctly handle `screen` set in the presets.

It was setting directly to `_private`, which both didn't work
and caused a memory leak.

Fix #3428
This commit is contained in:
Emmanuel Lepage Vallee 2021-09-16 16:26:07 -07:00
parent 21a111d154
commit e752943b98
1 changed files with 9 additions and 1 deletions

View File

@ -882,7 +882,15 @@ local function select_legacy_preset(n, args)
))
for k, v in pairs(n.preset) do
n._private[k] = v
-- Don't keep a strong reference to the screen, Lua 5.1 GC wont be
-- smart enough to unwind the mess of circular weak references.
if k ~= "screen" then
n._private[k] = v
end
end
if n.preset.screen then
n._private.weak_screen[1] = capi.screen[n.preset.screen]
end
end