From 3cc7843f0588ba8a7a0f7927bb9daf65b8802aff Mon Sep 17 00:00:00 2001 From: Michael Hofmann Date: Thu, 27 Nov 2008 11:20:25 +0100 Subject: [PATCH] awful.widget: fix iteration over removed elements Signed-off-by: Julien Danjou --- lib/awful/widget.lua.in | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/awful/widget.lua.in b/lib/awful/widget.lua.in index b7b849df..09dd6011 100644 --- a/lib/awful/widget.lua.in +++ b/lib/awful/widget.lua.in @@ -164,12 +164,14 @@ function tasklist.new(label, buttons) local w = {} local function tasklist_update () local clients = capi.client.get() + local shownclients = {} for k, c in ipairs(clients) do - if c.skip_taskbar or c.hide - or c.type == "splash" or c.type == "dock" or c.type == "desktop" then - table.remove(clients, k) + if not (c.skip_taskbar or c.hide + or c.type == "splash" or c.type == "dock" or c.type == "desktop") then + table.insert(shownclients, c) end end + clients = shownclients -- Hack: if it has been registered as a widget in a wibox, -- it's w.len since __len meta does not work on table until Lua 5.2. -- Otherwise it's standard #w.