awful.wibar: move wibar:remove() call outside of loop over all wiboxes (#1501)

Removing a wibar mid-loop will corrupt the indexing of the for loop and can
cause other wibars from being removed.
This commit is contained in:
Kevin Zander 2017-02-02 15:42:20 -06:00 committed by Daniel Hahler
parent d494b87fb7
commit e1aacfaa22
1 changed files with 5 additions and 1 deletions

View File

@ -359,11 +359,15 @@ function awfulwibar.new(arg)
end end
capi.screen.connect_signal("removed", function(s) capi.screen.connect_signal("removed", function(s)
local wibars = {}
for _, wibar in ipairs(wiboxes) do for _, wibar in ipairs(wiboxes) do
if wibar._screen == s then if wibar._screen == s then
wibar:remove() table.insert(wibars, wibar)
end end
end end
for _, wibar in ipairs(wibars) do
wibar:remove()
end
end) end)
function awfulwibar.mt:__call(...) function awfulwibar.mt:__call(...)