From 74adb19376a5771f18b3beec50fd378f5e82fbf5 Mon Sep 17 00:00:00 2001 From: Allen Faure Date: Mon, 25 Nov 2024 12:24:47 -0600 Subject: [PATCH 1/2] defer calls to ScanEvents & friends if it doesn't come from WeakAuras Primarily this ensures that we don't have any kind of reentrancy, which has the potential to break invariants. Fixes #5543 --- WeakAuras/BossMods.lua | 80 ++++++++++++------------- WeakAuras/GenericTrigger.lua | 110 +++++++++++++++++++++++------------ WeakAuras/Prototypes.lua | 6 +- 3 files changed, 117 insertions(+), 79 deletions(-) diff --git a/WeakAuras/BossMods.lua b/WeakAuras/BossMods.lua index 015313d3f2..dca015a35a 100644 --- a/WeakAuras/BossMods.lua +++ b/WeakAuras/BossMods.lua @@ -139,9 +139,9 @@ Private.ExecEnv.BossMods.DBM = { end if not bar.expired then bar.expired = true - WeakAuras.ScanEvents("DBM_TimerStop", timerId) + Private.ScanEvents("DBM_TimerStop", timerId) if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerStop", timerId) + Private.ScanEvents("BossMod_TimerStop", timerId) end end elseif self.nextExpire == nil then @@ -159,10 +159,10 @@ Private.ExecEnv.BossMods.DBM = { EventCallback = function(self, event, ...) if event == "DBM_Announce" then local message, icon, _, spellId, _, count = ... - WeakAuras.ScanEvents("DBM_Announce", spellId, message, icon) + Private.ScanEvents("DBM_Announce", spellId, message, icon) if self.isGeneric then count = count and tostring(count) or "0" - WeakAuras.ScanEvents("BossMod_Announce", spellId, message, icon, count) + Private.ScanEvents("BossMod_Announce", spellId, message, icon, count) end elseif event == "DBM_TimerStart" then local timerId, msg, duration, icon, timerType, spellId, dbmType, _, _, _, _, _, timerCount = ... @@ -211,9 +211,9 @@ Private.ExecEnv.BossMods.DBM = { end bar.dbmColor = {r, g, b} - WeakAuras.ScanEvents("DBM_TimerStart", timerId) + Private.ScanEvents("DBM_TimerStart", timerId) if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerStart", timerId) + Private.ScanEvents("BossMod_TimerStart", timerId) end if self.nextExpire == nil then self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, expirationTime - now, self) @@ -231,9 +231,9 @@ Private.ExecEnv.BossMods.DBM = { self.bars[timerId] = nil end bar.expired = true - WeakAuras.ScanEvents("DBM_TimerStop", timerId) + Private.ScanEvents("DBM_TimerStop", timerId) if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerStop", timerId) + Private.ScanEvents("BossMod_TimerStop", timerId) end end elseif event == "DBM_TimerPause" then @@ -242,9 +242,9 @@ Private.ExecEnv.BossMods.DBM = { if bar then bar.paused = true bar.remaining = bar.expirationTime - GetTime() - WeakAuras.ScanEvents("DBM_TimerPause", timerId) + Private.ScanEvents("DBM_TimerPause", timerId) if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerPause", timerId) + Private.ScanEvents("BossMod_TimerPause", timerId) end if self.recheckTimer then timer:CancelTimer(self.recheckTimer) @@ -258,9 +258,9 @@ Private.ExecEnv.BossMods.DBM = { bar.paused = nil bar.expirationTime = GetTime() + (bar.remaining or 0) bar.remaining = nil - WeakAuras.ScanEvents("DBM_TimerResume", timerId) + Private.ScanEvents("DBM_TimerResume", timerId) if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerResume", timerId) + Private.ScanEvents("BossMod_TimerResume", timerId) end if self.nextExpire == nil then self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, bar.expirationTime - GetTime(), self) @@ -288,9 +288,9 @@ Private.ExecEnv.BossMods.DBM = { self.nextExpire = expirationTime end end - WeakAuras.ScanEvents("DBM_TimerUpdate", timerId) + Private.ScanEvents("DBM_TimerUpdate", timerId) if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerUpdate", timerId) + Private.ScanEvents("BossMod_TimerUpdate", timerId) end elseif event == "DBM_TimerUpdateIcon" then local timerId, icon = ... @@ -298,14 +298,14 @@ Private.ExecEnv.BossMods.DBM = { if bar then bar.icon = icon end - WeakAuras.ScanEvents("DBM_TimerUpdateIcon", timerId) + Private.ScanEvents("DBM_TimerUpdateIcon", timerId) if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerUpdateIcon", timerId) + Private.ScanEvents("BossMod_TimerUpdateIcon", timerId) end elseif event == "DBM_SetStage" or event == "DBM_Pull" or event == "DBM_Wipe" or event == "DBM_Kill" then - WeakAuras.ScanEvents("DBM_SetStage") + Private.ScanEvents("DBM_SetStage") if self.isGeneric then - WeakAuras.ScanEvents("BossMod_SetStage") + Private.ScanEvents("BossMod_SetStage") end end end, @@ -343,9 +343,9 @@ Private.ExecEnv.BossMods.DBM = { DoScan = function(self, fireTime) self.scheduled_scans[fireTime] = nil - WeakAuras.ScanEvents("DBM_TimerUpdate") + Private.ScanEvents("DBM_TimerUpdate") if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerUpdate") + Private.ScanEvents("BossMod_TimerUpdate") end end, @@ -808,9 +808,9 @@ Private.ExecEnv.BossMods.BigWigs = { end if not bar.expired then bar.expired = true - WeakAuras.ScanEvents("BigWigs_StopBar", timerId) + Private.ScanEvents("BigWigs_StopBar", timerId) if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerStop", timerId) + Private.ScanEvents("BossMod_TimerStop", timerId) end end elseif self.nextExpire == nil then @@ -828,11 +828,11 @@ Private.ExecEnv.BossMods.BigWigs = { EventCallback = function(self, event, ...) if event == "BigWigs_Message" then - WeakAuras.ScanEvents("BigWigs_Message", ...) + Private.ScanEvents("BigWigs_Message", ...) if self.isGeneric then local _, spellId, text, _, icon = ... local count = text and text:match("%((%d+)%)") or text:match("((%d+))") or "0" - WeakAuras.ScanEvents("BossMod_Announce", spellId, text, icon, count) + Private.ScanEvents("BossMod_Announce", spellId, text, icon, count) end elseif event == "BigWigs_StartBar" then local addon, spellId, text, duration, icon, isCD = ... @@ -857,9 +857,9 @@ Private.ExecEnv.BossMods.BigWigs = { bar.count = text:match("%((%d+)%)") or text:match("((%d+))") or "0" bar.cast = not(text:match("^[^<]") and true) - WeakAuras.ScanEvents("BigWigs_StartBar", text) + Private.ScanEvents("BigWigs_StartBar", text) if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerStart", text) + Private.ScanEvents("BossMod_TimerStart", text) end if self.nextExpire == nil then self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, expirationTime - now, self) @@ -876,9 +876,9 @@ Private.ExecEnv.BossMods.BigWigs = { if bar.scheduledScanExpireAt == nil or bar.scheduledScanExpireAt <= GetTime() then self.bars[text] = nil end - WeakAuras.ScanEvents("BigWigs_StopBar", text) + Private.ScanEvents("BigWigs_StopBar", text) if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerStop", text) + Private.ScanEvents("BossMod_TimerStop", text) end end elseif event == "BigWigs_PauseBar" then @@ -887,9 +887,9 @@ Private.ExecEnv.BossMods.BigWigs = { if bar and not bar.paused then bar.paused = true bar.remaining = bar.expirationTime - GetTime() - WeakAuras.ScanEvents("BigWigs_PauseBar", text) + Private.ScanEvents("BigWigs_PauseBar", text) if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerPause", text) + Private.ScanEvents("BossMod_TimerPause", text) end if self.recheckTimer then timer:CancelTimer(self.recheckTimer) @@ -903,9 +903,9 @@ Private.ExecEnv.BossMods.BigWigs = { bar.paused = nil bar.expirationTime = GetTime() + (bar.remaining or 0) bar.remaining = nil - WeakAuras.ScanEvents("BigWigs_ResumeBar", text) + Private.ScanEvents("BigWigs_ResumeBar", text) if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerResume", text) + Private.ScanEvents("BossMod_TimerResume", text) end if self.nextExpire == nil then self.recheckTimer = timer:ScheduleTimerFixed(self.RecheckTimers, bar.expirationTime - GetTime(), self) @@ -923,24 +923,24 @@ Private.ExecEnv.BossMods.BigWigs = { for timerId, bar in pairs(self.bars) do if bar.addon == addon then self.bars[timerId] = nil - WeakAuras.ScanEvents("BigWigs_StopBar", timerId) + Private.ScanEvents("BigWigs_StopBar", timerId) if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerStop", timerId) + Private.ScanEvents("BossMod_TimerStop", timerId) end end end elseif event == "BigWigs_SetStage" then local addon, stage = ... self.currentStage = stage - WeakAuras.ScanEvents("BigWigs_SetStage") + Private.ScanEvents("BigWigs_SetStage") if self.isGeneric then - WeakAuras.ScanEvents("BossMod_SetStage") + Private.ScanEvents("BossMod_SetStage") end elseif event == "BigWigs_OnBossWipe" or event == "BigWigs_OnBossWin" then self.currentStage = 0 - WeakAuras.ScanEvents("BigWigs_SetStage") + Private.ScanEvents("BigWigs_SetStage") if self.isGeneric then - WeakAuras.ScanEvents("BossMod_SetStage") + Private.ScanEvents("BossMod_SetStage") end end end, @@ -990,9 +990,9 @@ Private.ExecEnv.BossMods.BigWigs = { DoScan = function(self, fireTime) self.scheduled_scans[fireTime] = nil - WeakAuras.ScanEvents("BigWigs_Timer_Update") + Private.ScanEvents("BigWigs_Timer_Update") if self.isGeneric then - WeakAuras.ScanEvents("BossMod_TimerUpdate") + Private.ScanEvents("BossMod_TimerUpdate") end end, diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 32f197b2f5..27858c8b3a 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -835,21 +835,47 @@ local function getGameEventFromComposedEvent(composedEvent) return separatorPosition == nil and composedEvent or composedEvent:sub(1, separatorPosition - 1) end +local scannerFrame = CreateFrame("Frame") +scannerFrame.queue = {} +scannerFrame:Hide() +scannerFrame:SetScript("OnUpdate", function(self) + local todo = self.queue + self.queue = {} + for _, event in ipairs(todo) do + event.func(unpack(event.args)) + end + -- there's a chance that a joker dispatched an event in in trigger code, + -- so the queue might already be populated + -- in that case, we'll process next frame by declining to hide + if #self.queue == 0 then + self:Hide() + end +end) + +function scannerFrame:Queue(func, ...) + tinsert(self.queue, {func = func, args = {...}}) + self:Show() +end + function Private.ScanEventsByID(event, id, ...) if loaded_events[event] then - WeakAuras.ScanEvents(event, id, ...) + Private.ScanEvents(event, id, ...) end local eventWithID = event .. ":" .. id if loaded_events[eventWithID] then - WeakAuras.ScanEvents(eventWithID, id, ...) + Private.ScanEvents(eventWithID, id, ...) end end +function WeakAuras.ScanEventsByID(event, id, ...) + scannerFrame:Queue(Private.ScanEventsByID, event, id, ...) +end + ---@param event string ---@param arg1? any ---@param arg2? any ---@param ... any -function WeakAuras.ScanEvents(event, arg1, arg2, ...) +function Private.ScanEvents(event, arg1, arg2, ...) local system = getGameEventFromComposedEvent(event) Private.StartProfileSystem("generictrigger " .. system) local event_list = loaded_events[event]; @@ -865,24 +891,28 @@ function WeakAuras.ScanEvents(event, arg1, arg2, ...) Private.StopProfileSystem("generictrigger " .. system) return; end - WeakAuras.ScanEventsInternal(event_list, event, CombatLogGetCurrentEventInfo()); + Private.ScanEventsInternal(event_list, event, CombatLogGetCurrentEventInfo()); elseif (event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM") then -- This reverts the COMBAT_LOG_EVENT_UNFILTERED_CUSTOM workaround so that custom triggers that check the event argument will work as expected if(event == "COMBAT_LOG_EVENT_UNFILTERED_CUSTOM") then event = "COMBAT_LOG_EVENT_UNFILTERED"; end - WeakAuras.ScanEventsInternal(event_list, event, CombatLogGetCurrentEventInfo()); + Private.ScanEventsInternal(event_list, event, CombatLogGetCurrentEventInfo()); else - WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ...); + Private.ScanEventsInternal(event_list, event, arg1, arg2, ...); end Private.StopProfileSystem("generictrigger " .. system) end +function WeakAuras.ScanEvents(event, arg1, arg2, ...) + scannerFrame:Queue(Private.ScanEvents, event, arg1, arg2, ...) +end + ---@param event string ---@param unit UnitToken ---@param ... any -function WeakAuras.ScanUnitEvents(event, unit, ...) +function Private.ScanUnitEvents(event, unit, ...) Private.StartProfileSystem("generictrigger " .. event .. " " .. unit) local unit_list = loaded_unit_events[unit] if unit_list then @@ -914,13 +944,17 @@ function WeakAuras.ScanUnitEvents(event, unit, ...) Private.StopProfileSystem("generictrigger " .. event .. " " .. unit) end +function WeakAuras.ScanUnitEvents(event, unit, ...) + scannerFrame:Queue(Private.ScanUnitEvents, event, unit, ...) +end + ---@private ---@param event_list table ---@param event string ---@param arg1? any ---@param arg2? any ---@param ... any -function WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ... ) +function Private.ScanEventsInternal(event_list, event, arg1, arg2, ... ) for id, triggers in pairs(event_list) do Private.StartProfileAura(id); Private.ActivateAuraEnvironment(id); @@ -944,6 +978,10 @@ function WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ... ) end end +function WeakAuras.ScanEventsInternal(event_list, event, arg1, arg2, ... ) + scannerFrame:Queue(Private.ScanEventsInternal, event_list, event, arg1, arg2, ...) +end + do local function RunTriggerFuncForDelay(id, triggernum, data, event, ...) Private.StartProfileAura(id) @@ -1154,12 +1192,12 @@ function HandleEvent(frame, event, arg1, arg2, ...) if not(WeakAuras.IsPaused()) then if(event == "COMBAT_LOG_EVENT_UNFILTERED") then - WeakAuras.ScanEvents(event); + Private.ScanEvents(event); -- This triggers the scanning of "hacked" COMBAT_LOG_EVENT_UNFILTERED events that were renamed in order to circumvent -- the "proper" COMBAT_LOG_EVENT_UNFILTERED checks - WeakAuras.ScanEvents("COMBAT_LOG_EVENT_UNFILTERED_CUSTOM"); + Private.ScanEvents("COMBAT_LOG_EVENT_UNFILTERED_CUSTOM"); else - WeakAuras.ScanEvents(event, arg1, arg2, ...); + Private.ScanEvents(event, arg1, arg2, ...); end end if (event == "PLAYER_ENTERING_WORLD") then @@ -1188,7 +1226,7 @@ function HandleUnitEvent(frame, event, unit, ...) Private.StartProfileSystem("generictrigger " .. event .. " " .. unit); if not(WeakAuras.IsPaused()) then if (UnitIsUnit(unit, frame.unit)) then - WeakAuras.ScanUnitEvents(event, frame.unit, ...); + Private.ScanUnitEvents(event, frame.unit, ...); end end Private.StopProfileSystem("generictrigger " .. event .. " " .. unit); @@ -1477,11 +1515,11 @@ function GenericTrigger.LoadDisplays(toLoad, loadEvent, ...) -- Replay events that lead to loading, if we weren't already registered for them if (eventsToRegister[loadEvent]) then - WeakAuras.ScanEvents(loadEvent, ...); + Private.ScanEvents(loadEvent, ...); end local loadUnit = ... if loadUnit and unitEventsToRegister[loadUnit] and unitEventsToRegister[loadUnit][loadEvent] then - WeakAuras.ScanUnitEvents(loadEvent, ...); + Private.ScanUnitEvents(loadEvent, ...); end wipe(eventsToRegister); @@ -1887,7 +1925,7 @@ do if not(updating) then update_frame:SetScript("OnUpdate", function(self, elapsed) if not(WeakAuras.IsPaused()) then - WeakAuras.ScanEvents("FRAME_UPDATE", elapsed); + Private.ScanEvents("FRAME_UPDATE", elapsed); end end); updating = true; @@ -1983,7 +2021,7 @@ do end local function swingTriggerUpdate() - WeakAuras.ScanEvents("SWING_TIMER_UPDATE") + Private.ScanEvents("SWING_TIMER_UPDATE") end local function swingEnd(hand) @@ -2257,7 +2295,7 @@ do gcdEndCheck = 0; end if(event and not WeakAuras.IsPaused()) then - WeakAuras.ScanEvents(event); + Private.ScanEvents(event); end end @@ -2826,7 +2864,7 @@ do gcdSpellName = name; gcdSpellIcon = icon; if not WeakAuras.IsPaused() then - WeakAuras.ScanEvents("GCD_UPDATE") + Private.ScanEvents("GCD_UPDATE") end end end @@ -2930,7 +2968,7 @@ do end lastTime = now Private.StopProfileSystem("generictrigger essence") - WeakAuras.ScanEvents("ESSENCE_UPDATE") + Private.ScanEvents("ESSENCE_UPDATE") end essenceEventFrame:SetScript("OnEvent", essenceEventHandler) essenceEventFrame:Show() @@ -3081,7 +3119,7 @@ do runeCdHandles[id] = nil; runeCdDurs[id] = nil; runeCdExps[id] = nil; - WeakAuras.ScanEvents("RUNE_COOLDOWN_READY", id); + Private.ScanEvents("RUNE_COOLDOWN_READY", id); end local function ItemCooldownFinished(id) @@ -3124,7 +3162,7 @@ do runeCdDurs[id] = duration; runeCdExps[id] = endTime; runeCdHandles[id] = timer:ScheduleTimerFixed(RuneCooldownFinished, endTime - time, id); - WeakAuras.ScanEvents("RUNE_COOLDOWN_STARTED", id); + Private.ScanEvents("RUNE_COOLDOWN_STARTED", id); elseif(runeCdExps[id] ~= endTime) then -- Cooldown is now different if(runeCdHandles[id]) then @@ -3133,7 +3171,7 @@ do runeCdDurs[id] = duration; runeCdExps[id] = endTime; runeCdHandles[id] = timer:ScheduleTimerFixed(RuneCooldownFinished, endTime - time, id); - WeakAuras.ScanEvents("RUNE_COOLDOWN_CHANGED", id); + Private.ScanEvents("RUNE_COOLDOWN_CHANGED", id); end elseif(duration > 0) then -- GCD, do nothing @@ -3797,7 +3835,7 @@ function WeakAuras.WatchUnitChange(unit) handleEvent[event](unit, eventsToSend) -- send events for event, unit in pairs(eventsToSend) do - WeakAuras.ScanEvents(event, unit) + Private.ScanEvents(event, unit) end Private.StopProfileSystem("generictrigger unit change"); @@ -3861,7 +3899,7 @@ function Private.WatchStagger() local stagger = UnitStagger("player") if stagger ~= staggerWatchFrame.stagger then staggerWatchFrame.stagger = stagger - WeakAuras.ScanEvents("WA_UNIT_STAGGER_CHANGED", "player", stagger) + Private.ScanEvents("WA_UNIT_STAGGER_CHANGED", "player", stagger) end if stagger == 0 then staggerWatchFrame:SetScript("OnUpdate", nil) @@ -3874,7 +3912,7 @@ function Private.WatchStagger() if stagger ~= staggerWatchFrame.stagger then staggerWatchFrame.stagger = stagger - WeakAuras.ScanEvents("WA_UNIT_STAGGER_CHANGED", "player", stagger) + Private.ScanEvents("WA_UNIT_STAGGER_CHANGED", "player", stagger) end Private.StopProfileSystem("stagger") end) @@ -3958,7 +3996,7 @@ if WeakAuras.IsClassicEra() then end if newQueuedSpell ~= self.queuedSpell then self.queuedSpell = newQueuedSpell - WeakAuras.ScanEvents("WA_UNIT_QUEUED_SPELL_CHANGED", "player") + Private.ScanEvents("WA_UNIT_QUEUED_SPELL_CHANGED", "player") end end) end @@ -4117,7 +4155,7 @@ do rw_icon = GetInventoryItemTexture("player", rw) end end - WeakAuras.ScanEvents("TENCH_UPDATE"); + Private.ScanEvents("TENCH_UPDATE"); Private.StopProfileSystem("generictrigger temporary enchant"); end @@ -4155,7 +4193,7 @@ do petFrame:RegisterUnitEvent("UNIT_PET", "player") petFrame:SetScript("OnEvent", function(event, unit) Private.StartProfileSystem("generictrigger pet update") - WeakAuras.ScanEvents("PET_UPDATE", "pet") + Private.ScanEvents("PET_UPDATE", "pet") Private.StopProfileSystem("generictrigger pet update") end) end @@ -4170,7 +4208,7 @@ do watchFrame:RegisterEvent("COMBO_TARGET_CHANGED") watchFrame:SetScript("OnEvent", function() Private.StartProfileSystem("generictrigger COMBO_TARGET_CHANGED") - WeakAuras.ScanEvents("WA_COMBO_TARGET_CHANGED", "player") + Private.ScanEvents("WA_COMBO_TARGET_CHANGED", "player") Private.StopProfileSystem("generictrigger COMBO_TARGET_CHANGED") end) end @@ -4247,7 +4285,7 @@ do or (newTargetGUID ~= nil and targetGUID ~= newTargetGUID) then nameplateTargets[unit] = newTargetGUID or true - WeakAuras.ScanEvents("WA_UNIT_TARGET_NAME_PLATE", unit) + Private.ScanEvents("WA_UNIT_TARGET_NAME_PLATE", unit) end end throttle_update = tick_throttle @@ -4281,13 +4319,13 @@ do local moving = IsPlayerMoving() if (playerMovingFrame.moving ~= moving or playerMovingFrame.moving == nil) then playerMovingFrame.moving = moving - WeakAuras.ScanEvents("PLAYER_MOVING_UPDATE") + Private.ScanEvents("PLAYER_MOVING_UPDATE") end local speed = GetUnitSpeed("player") if playerMovingFrame.speed ~= speed then playerMovingFrame.speed = speed - WeakAuras.ScanEvents("PLAYER_MOVE_SPEED_UPDATE") + Private.ScanEvents("PLAYER_MOVE_SPEED_UPDATE") end Private.StopProfileSystem("generictrigger player moving"); end @@ -4315,7 +4353,7 @@ function WeakAuras.RegisterItemCountWatch() local batchUpdateCount = function() itemCountWatchFrame:SetScript("OnUpdate", nil) Private.StartProfileSystem("generictrigger ITEM_COUNT_UPDATE") - WeakAuras.ScanEvents("ITEM_COUNT_UPDATE") + Private.ScanEvents("ITEM_COUNT_UPDATE") Private.StopProfileSystem("generictrigger ITEM_COUNT_UPDATE") end itemCountWatchFrame:SetScript("OnEvent", function(self, event) @@ -4339,7 +4377,7 @@ end -- early if anyone wants the event if WeakAuras.IsCataOrRetail() then Private.LibSpecWrapper.Register(function(unit) - WeakAuras.ScanEvents("UNIT_SPEC_CHANGED_" .. unit, unit) + Private.ScanEvents("UNIT_SPEC_CHANGED_" .. unit, unit) end) end @@ -4348,7 +4386,7 @@ do local function doScan(fireTime, event) scheduled_scans[event][fireTime] = nil; - WeakAuras.ScanEvents(event); + Private.ScanEvents(event); end function Private.ExecEnv.ScheduleScan(fireTime, event) event = event or "COOLDOWN_REMAINING_CHECK" @@ -4364,7 +4402,7 @@ do local function doCastScan(firetime, unit) scheduled_scans[unit][firetime] = nil; - WeakAuras.ScanEvents("CAST_REMAINING_CHECK_" .. string.lower(unit), unit); + Private.ScanEvents("CAST_REMAINING_CHECK_" .. string.lower(unit), unit); end function Private.ExecEnv.ScheduleCastCheck(fireTime, unit) scheduled_scans[unit] = scheduled_scans[unit] or {} diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index 12e8733c07..1431a2ad5f 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -136,7 +136,7 @@ if WeakAuras.IsRetail() then castLatencyFrame:GetScript("OnEvent")(nil, event, unit, ...) end end - WeakAuras.ScanUnitEvents(event.."_FAKE", unit, ...) + Private.ScanUnitEvents(event.."_FAKE", unit, ...) end) else WeakAuras.UnitChannelInfo = UnitChannelInfo @@ -766,7 +766,7 @@ if WeakAuras.IsRetail() then end end Private.ScanForLoads(nil, "WA_TALENT_UPDATE") - WeakAuras.ScanEvents("WA_TALENT_UPDATE") + Private.ScanEvents("WA_TALENT_UPDATE") if (event == "WA_DELAYED_PLAYER_ENTERING_WORLD" or event == "PLAYER_TALENT_UPDATE") then C_Timer.After(1, function() @@ -1158,7 +1158,7 @@ do if waitingFor[itemId] then waitingFor[itemId] = nil if success then - WeakAuras.ScanEvents("WA_DELAYED_SET_INFORMATION") + Private.ScanEvents("WA_DELAYED_SET_INFORMATION") end if next(waitingFor) == nil then itemDataLoadFrame:UnregisterEvent("GET_ITEM_INFO_RECEIVED") From 5bfb2a723bc4916f6e8be8508d04cf4b53783ae7 Mon Sep 17 00:00:00 2001 From: Allen Faure Date: Tue, 26 Nov 2024 17:16:35 -0600 Subject: [PATCH 2/2] be more careful about getting tooltip data since C_Tooltip functions complain when given nil --- WeakAuras/GenericTrigger.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WeakAuras/GenericTrigger.lua b/WeakAuras/GenericTrigger.lua index 27858c8b3a..0edd0151b3 100644 --- a/WeakAuras/GenericTrigger.lua +++ b/WeakAuras/GenericTrigger.lua @@ -4603,10 +4603,10 @@ function GenericTrigger.SetToolTip(trigger, state) local prototype = GenericTrigger.GetPrototype(trigger) if prototype then if prototype.hasSpellID then - GameTooltip:SetSpellByID(trigger.spellName); + GameTooltip:SetSpellByID(trigger.spellName or 0); return true elseif prototype.hasItemID then - GameTooltip:SetHyperlink("item:"..trigger.itemName..":0:0:0:0:0:0:0") + GameTooltip:SetHyperlink("item:"..(trigger.itemName or 0)..":0:0:0:0:0:0:0") return true end end