Skip to content

Commit cbf20fe

Browse files
committed
Fix OnSizeChanged callback spreading taint
1 parent 55f6701 commit cbf20fe

2 files changed

Lines changed: 23 additions & 53 deletions

File tree

AdventureGuideLockouts.lua

Lines changed: 21 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local _, AddOn = ...
1+
local ADDON_NAME, AddOn = ...
22

33
AddOn.worldBosses = {
44
{
@@ -331,36 +331,6 @@ function AddOn:UpdateStatusFramePosition(orderIndex)
331331
end
332332
end
333333

334-
--[[
335-
TODO: Find a solution for this, if that's even possible.
336-
Showing any status frame is firing OnSizeChanged callback and taints the Adventure Guide.
337-
This removes the taint:
338-
local scrollBox = EncounterJournal.instanceSelect.ScrollBox
339-
scrollBox:GetScrollTarget():UnregisterCallback("OnSizeChanged", scrollBox)
340-
This is the stack trace using taintLog 11 on the 10.1.5 PTR:
341-
Global variable extent tainted by AdventureGuideLockouts - Interface/SharedXML/Scroll/ScrollBoxView.lua:76 SetExtent()
342-
Interface/SharedXML/Scroll/ScrollBoxListView.lua:647
343-
Interface/SharedXML/Scroll/ScrollBox.lua:176 FullUpdateInternal()
344-
Interface/SharedXML/Scroll/ScrollBox.lua:674 Frame:FullUpdateInternal()
345-
Interface/SharedXML/Scroll/ScrollBox.lua:144 Frame:FullUpdate()
346-
Interface/SharedXML/Scroll/ScrollBox.lua:125
347-
securecallfunction()
348-
Interface/SharedXML/CallbackRegistry.lua:178
349-
secureexecuterange()
350-
Interface/SharedXML/CallbackRegistry.lua:181 Frame:TriggerEvent()
351-
Interface/SharedXML/Frame/EventFrame.lua:47
352-
Frame:Show()
353-
Interface/AddOns/AdventureGuideLockouts/AdventureGuideLockouts.lua:372 UpdateInstanceStatusFrame()
354-
Interface/AddOns/AdventureGuideLockouts/AdventureGuideLockouts.lua:407 func()
355-
Interface/SharedXML/Scroll/ScrollBoxListView.lua:142 ForEachFrame()
356-
Interface/SharedXML/Scroll/ScrollBox.lua:531 Frame:ForEachFrame()
357-
Interface/AddOns/AdventureGuideLockouts/AdventureGuideLockouts.lua:405
358-
EncounterJournal_ListInstances()
359-
Interface/AddOns/Blizzard_EncounterJournal/Blizzard_EncounterJournal.lua:2508 EJ_ContentTab_Select()
360-
Interface/AddOns/Blizzard_EncounterJournal/Blizzard_EncounterJournal.lua:2471 EJ_ContentTab_OnClick()
361-
EncounterJournalDungeonTab:lizzard_EncounterJournal.xml:1385_OnClick()
362-
--]]
363-
364334
---@param button Button
365335
---@param elementData table
366336
function AddOn:UpdateInstanceStatusFrame(button, elementData)
@@ -374,57 +344,57 @@ function AddOn:UpdateInstanceStatusFrame(button, elementData)
374344
end
375345
end
376346

377-
if not instances then return end
347+
if not instances then
348+
return
349+
end
378350

379351
for i = 1, #instances do
380352
local instance = instances[i]
381353
local frame = self.statusFrames[orderIndex] and self.statusFrames[orderIndex][instance.difficulty] or self:CreateStatusFrame(button, orderIndex, instance.difficulty)
382354
if instance.complete then
383355
frame.completeFrame:Show()
384356
frame.progressFrame:Hide()
385-
frame:Show()
386357
elseif instance.progress then
387358
frame.completeFrame:Hide()
388359
frame.progressFrame:SetText(instance.progress)
389360
frame.progressFrame:Show()
390-
frame:Show()
391-
else
392-
frame:Hide()
393361
end
394362
frame.instanceInfo = instance
363+
364+
-- This prevents ScrollTarget's OnSizeChanged callback from being fired with taint.
365+
RunNextFrame(function() frame:Show() end)
395366
end
396367

397368
self:UpdateStatusFramePosition(orderIndex)
398369
end
399370

400-
-- This fixes an issue with the original function
401-
-- not setting the mapID correctly in the data provider.
402-
local function UpdateDataProviderAndFrames()
371+
local function UpdateFrames()
403372
local dataIndex = 1
404373
local showRaid = EncounterJournal_IsRaidTabSelected(EncounterJournal)
405-
local mapID = select(11, EJ_GetInstanceByIndex(dataIndex, showRaid))
406374
EncounterJournal.instanceSelect.ScrollBox:ForEachFrame(function(frame, elementData)
407-
elementData.mapID = mapID
375+
-- This fixes an issue with the original function not setting the mapID correctly in the data provider.
376+
elementData.mapID = select(11, EJ_GetInstanceByIndex(dataIndex, showRaid))
408377
AddOn:UpdateInstanceStatusFrame(frame, elementData)
409378
dataIndex = dataIndex + 1
410-
mapID = select(11, EJ_GetInstanceByIndex(dataIndex, showRaid))
411379
end)
412380
end
413381

414382
local frame = CreateFrame("Frame")
415-
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
416383
frame:RegisterEvent("ADDON_LOADED")
417384
frame:RegisterEvent("BOSS_KILL")
418385
frame:RegisterEvent("UPDATE_INSTANCE_INFO")
419386
frame:SetScript("OnEvent", function(_, event, arg1)
420-
if event == "PLAYER_ENTERING_WORLD" then
421-
AddOn.playerFaction = UnitFactionGroup("player")
422-
AddOn.worldBosses[5].encounters[4].encounterID = AddOn.playerFaction == "Horde" and 2212 or 2213
423-
AddOn.worldBosses[5].encounters[4].questID = AddOn.playerFaction == "Horde" and 52848 or 52847
424-
AddOn.worldBosses[5].encounters[8].encounterID = AddOn.playerFaction == "Horde" and 2329 or 2345
425-
AddOn.worldBosses[5].encounters[8].questID = AddOn.playerFaction == "Horde" and 54896 or 54895
426-
elseif event == "ADDON_LOADED" and arg1 == "Blizzard_EncounterJournal" then
427-
hooksecurefunc("EncounterJournal_ListInstances", UpdateDataProviderAndFrames)
387+
if event == "ADDON_LOADED" then
388+
if arg1 == ADDON_NAME then
389+
local playerFaction = UnitFactionGroup("player")
390+
AddOn.worldBosses[5].encounters[4].encounterID = playerFaction == "Horde" and 2212 or 2213
391+
AddOn.worldBosses[5].encounters[4].questID = playerFaction == "Horde" and 52848 or 52847
392+
AddOn.worldBosses[5].encounters[8].encounterID = playerFaction == "Horde" and 2329 or 2345
393+
AddOn.worldBosses[5].encounters[8].questID = playerFaction == "Horde" and 54896 or 54895
394+
AddOn.playerFaction = playerFaction
395+
elseif arg1 == "Blizzard_EncounterJournal" then
396+
hooksecurefunc("EncounterJournal_ListInstances", UpdateFrames)
397+
end
428398
elseif event == "BOSS_KILL" then
429399
RequestRaidInfo()
430400
elseif event == "UPDATE_INSTANCE_INFO" then

AdventureGuideLockouts.toc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
## Interface: 100105
1+
## Interface: 100107
22
## Title: Adventure Guide Lockouts
33
## Notes: Adds instance status indicators to Adventure Guide.
44
## Notes-frFR: Ajoute des indicateurs de verrouillage d'instance au Guide de l'aventurier.
55
## Notes-ruRU: Добавляет индикаторы состояния подземелья в Путеводитель по приключениям.
66
## Author: alex_chrome, Meivyn
77
## IconTexture: Interface\EncounterJournal\UI-EJ-PortraitIcon
8-
## Version: 1.4.7
8+
## Version: 1.4.8
99

1010
AdventureGuideLockouts.lua

0 commit comments

Comments
 (0)