tag: Avoid a race condition when deleting tags.

Since the screen removal patchset, the tags properties were
cleaned too early. This caused code connecting to "property::activated"
to be called with the tag already partially deleted. For code depending
on those properties, such as radical.impl.taglist, this caused errors.
This commit is contained in:
Emmanuel Lepage Vallee 2016-05-16 19:17:17 -04:00
parent a41fb9a661
commit 6e6c4c3a5d
1 changed files with 4 additions and 2 deletions

View File

@ -295,7 +295,6 @@ function tag.object.delete(self, fallback_tag, force)
-- delete the tag -- delete the tag
data.tags[self].screen = nil data.tags[self].screen = nil
data.tags[self] = nil
self.activated = false self.activated = false
-- Update all indexes -- Update all indexes
@ -1387,7 +1386,10 @@ capi.screen.connect_signal("removed", function(s)
-- If any tag survived until now, forcefully get rid of it -- If any tag survived until now, forcefully get rid of it
for _, t in pairs(s.tags) do for _, t in pairs(s.tags) do
t.activated = false t.activated = false
data.tags[t] = nil
if data.tags[t] then
data.tags[t].screen = nil
end
end end
end) end)