From 94cac7b6b5c682400e7ef3762b8130fcda30b331 Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Mon, 4 Jun 2007 01:39:17 +0000 Subject: [PATCH] * Fixes an odd condition where a frame would stop updating. --- PerfectRaid.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/PerfectRaid.lua b/PerfectRaid.lua index f01c8f9..b0b0b52 100644 --- a/PerfectRaid.lua +++ b/PerfectRaid.lua @@ -520,13 +520,24 @@ function OnAttributeChanged(frame, name, value) if name ~= "unit" then return end local self = PerfectRaid + + -- This code finds all instances of the current frame + -- and clears them from the unit table. This is exhaustive + -- to ensure nothing is left referencing this frame. for unit,tbl in pairs(frames) do if tbl[frame] and frame:GetAttribute("unit") ~= unit then tbl[frame] = nil end end + -- If we've been given a unit, instead of nil if value then + -- Register us for frame updates under the correct unit ID. + frames[unit] = frames[unit] or {} + frames[unit][frame] = true + + -- Use the unitname to check if we need to update config + -- even if the unitID changed. local unitname = UnitName(value) if not frame.unit then frame.unit = value @@ -536,7 +547,8 @@ function OnAttributeChanged(frame, name, value) return end end - + + -- Set the variables we use to check/clear frame.unit = value frame.unitname = unitname @@ -573,9 +585,6 @@ function OnAttributeChanged(frame, name, value) frame.status:SetText(nil) - frames[unit] = frames[unit] or {} - frames[unit][frame] = true - for name,module in self:IterateModules() do if type(module.ShowButton) == "function" then module:ShowButton(frame) -- 1.7.9.5