Skip to content

Commit

Permalink
Change EnsureRegion to not create child regions for dynamic groups
Browse files Browse the repository at this point in the history
We need to ensure that aura data is first Added() before SetRegion() is
called. For reasons that I don't remember EnsureRegion for a dynamic
group would call EnsureRegion on all children.

Since we do a top-down Adding of auras, this would result in trying to
create regions for auras that weren't yet added.

Thus remove that and see what breaks...

Fixes: #4928
  • Loading branch information
InfusOnWoW committed Mar 20, 2024
1 parent 4d89f57 commit e2cf1ad
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions WeakAuras/WeakAuras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3298,46 +3298,21 @@ local function EnsureRegion(id)

-- The region doesn't yet exist
-- But we must also ensure that our parents exists
-- and as an additional wrinkle, for dynamic groups, all children must exist!
-- and we have to call ReloadControlledChildren at the end

-- So we go up the list of parents and collect auras that must be created
-- If we find a parent already exists, we can stop
-- And dynamic groups require creating all children, thus we don't need
-- to care which path we came to them
--- @type auraId[]
local aurasToCreate = {}
--- @type auraId[]
local dynamicGroups = {}

creatingRegions = true
while(id) do
local data = WeakAuras.GetData(id)
if (data.regionType == "dynamicgroup") then
wipe(aurasToCreate)
tinsert(aurasToCreate, data.id)
tinsert(dynamicGroups, data.id)
else
tinsert(aurasToCreate, data.id)
end
tinsert(aurasToCreate, data.id)
id = data.parent
end


for _, toCreateId in ipairs_reverse(aurasToCreate) do
local data = WeakAuras.GetData(toCreateId)
Private.SetRegion(data)
if (data.regionType == "dynamicgroup") then
for child in Private.TraverseAllChildren(data) do
Private.SetRegion(child)
end
end
end

creatingRegions = false
for _, dynamicGroupId in ipairs_reverse(dynamicGroups) do
local dgRegion = Private.regions[dynamicGroupId].region
dgRegion:ReloadControlledChildren()
end
end
return Private.regions[id] and Private.regions[id].region
Expand Down

0 comments on commit e2cf1ad

Please sign in to comment.