From 1be205d8de3846cb2cb8b5b22eafdafe9493a3cf Mon Sep 17 00:00:00 2001 From: Xinhuan Date: Mon, 8 Dec 2008 08:29:07 +0800 Subject: [PATCH] Clear the guidNameLookup table on zoning to recover some memory. --- Omen.lua | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Omen.lua b/Omen.lua index 5679321..f6984e5 100644 --- a/Omen.lua +++ b/Omen.lua @@ -534,7 +534,7 @@ function Omen:OnEnable() --self:RegisterEvent("RAID_ROSTER_UPDATE", "PARTY_MEMBERS_CHANGED") -- Is this needed? self:RegisterEvent("PLAYER_UPDATE_RESTING", "UpdateVisible") - self:RegisterEvent("PLAYER_ENTERING_WORLD", "UpdateVisible") + self:RegisterEvent("PLAYER_ENTERING_WORLD") if db.ShowWith.HideWhenOOC then self:RegisterEvent("PLAYER_REGEN_DISABLED", "UpdateVisible") @@ -679,8 +679,6 @@ function Omen:_toggle(setting) end function Omen:UpdateVisible(event) - if event == "PLAYER_ENTERING_WORLD" then manualToggle = false end - local t = db.ShowWith if not t.UseShowWith or manualToggle then return end @@ -1191,10 +1189,13 @@ function Omen:UpdatePartyGUIDs() if me then -- Because it sometimes is nil on zoning/logging in. guidNameLookup[me] = UnitName("player") _, guidClassLookup[me] = UnitClass("player") + else + timers.UpdatePartyGUIDs = self:ScheduleTimer("UpdatePartyGUIDs", 0.5) end if UnitExists("pet") then - guidClassLookup[UnitGUID("pet")] = "PET" - guidNameLookup[UnitGUID("pet")] = UnitName("pet")--.." ["..UnitName("player").."]" + local petGUID = UnitGUID("pet") + guidClassLookup[petGUID] = "PET" + guidNameLookup[petGUID] = UnitName("pet")--.." ["..UnitName("player").."]" end if inParty or inRaid then @@ -1220,9 +1221,15 @@ function Omen:UpdatePartyGUIDs() end end end + guidNameLookup["AGGRO"] = L["> Pull Aggro <"] guidClassLookup["AGGRO"] = "AGGRO" end -guidNameLookup["AGGRO"] = L["> Pull Aggro <"] + +function Omen:PLAYER_ENTERING_WORLD() + manualToggle = false + wipe(guidNameLookup) + self:PARTY_MEMBERS_CHANGED() +end -----------------------------------------------------------------------------