Account for async processing in OnAllGarrisonMissions
Alar of Daggerspine [06-13-16 - 06:50]
Account for async processing in OnAllGarrisonMissions
diff --git a/MissionCache.lua b/MissionCache.lua
index 8f0bd73..00d306e 100644
--- a/MissionCache.lua
+++ b/MissionCache.lua
@@ -230,9 +230,14 @@ print("Iterator called, list is",list)
end
function module:OnAllGarrisonMissions(func,inProgress,missionType)
local list=inProgress and GMFMissions.inProgressMissions or GMFMissions.availableMissions
+ local tmp=addon:NewTable()
if type(list)=='table' then
for i=1,#list do
- func(list[i].missionID)
+ tinsert(tmp,list[i].missionID)
+ end
+ list=nil --we no longer need this reference
+ for i=1,#tmp do
+ func(tmp[i])
end
end
end