diff --git a/Extensions/Mouseover/Dragonflight3.lua b/Extensions/Mouseover/Dragonflight3.lua index 8d59325..dbe7b3c 100644 --- a/Extensions/Mouseover/Dragonflight3.lua +++ b/Extensions/Mouseover/Dragonflight3.lua @@ -14,6 +14,9 @@ Extension.RegisterEvent("PLAYER_ENTERING_WORLD", "DelayedInit") local hookedFrames = {} +-- Re-entrancy guard to prevent stack overflow +local isProcessing = false + function Extension.HookFrame(frame, unit) if not frame or hookedFrames[frame] then return end @@ -21,15 +24,23 @@ function Extension.HookFrame(frame, unit) local onLeave = frame:GetScript("OnLeave") frame:SetScript("OnEnter", function() - local u = unit or this.unit - if u then - CleveRoids.SetMouseoverFrom("df3", u) + if not isProcessing then + local u = unit or this.unit + if u then + isProcessing = true + CleveRoids.SetMouseoverFrom("df3", u) + isProcessing = false + end end if onEnter then onEnter() end end) frame:SetScript("OnLeave", function() - CleveRoids.ClearMouseoverFrom("df3") + if not isProcessing then + isProcessing = true + CleveRoids.ClearMouseoverFrom("df3") + isProcessing = false + end if onLeave then onLeave() end end) @@ -84,7 +95,7 @@ function Extension.HookAllFrames() -- Try mods directory structure (Dragonflight3 uses /mods/) if DF.mods then - for modName, mod in pairs(DF.mods) do + for _, mod in pairs(DF.mods) do if mod.frames then for unit, frame in pairs(mod.frames) do Extension.HookFrame(frame, unit) diff --git a/Extensions/Mouseover/DragonflightReloaded.lua b/Extensions/Mouseover/DragonflightReloaded.lua index ceaa0fc..57c43d6 100644 --- a/Extensions/Mouseover/DragonflightReloaded.lua +++ b/Extensions/Mouseover/DragonflightReloaded.lua @@ -13,6 +13,9 @@ Extension.RegisterEvent("PLAYER_ENTERING_WORLD", "DelayedInit") local hookedFrames = {} +-- Re-entrancy guard to prevent stack overflow +local isProcessing = false + function Extension.HookFrame(frame, unit) if not frame or hookedFrames[frame] then return end @@ -20,15 +23,23 @@ function Extension.HookFrame(frame, unit) local onLeave = frame:GetScript("OnLeave") frame:SetScript("OnEnter", function() - local u = unit or this.unit - if u then - CleveRoids.SetMouseoverFrom("dfr", u) + if not isProcessing then + local u = unit or this.unit + if u then + isProcessing = true + CleveRoids.SetMouseoverFrom("dfr", u) + isProcessing = false + end end if onEnter then onEnter() end end) frame:SetScript("OnLeave", function() - CleveRoids.ClearMouseoverFrom("dfr") + if not isProcessing then + isProcessing = true + CleveRoids.ClearMouseoverFrom("dfr") + isProcessing = false + end if onLeave then onLeave() end end) diff --git a/Extensions/Mouseover/LunaUnitFrames.lua b/Extensions/Mouseover/LunaUnitFrames.lua index 1f7fac2..bcadf5e 100644 --- a/Extensions/Mouseover/LunaUnitFrames.lua +++ b/Extensions/Mouseover/LunaUnitFrames.lua @@ -17,6 +17,9 @@ Extension.RegisterEvent("PLAYER_ENTERING_WORLD", "DelayedInit") -- Track which frames we've hooked local hookedFrames = {} +-- Re-entrancy guard to prevent stack overflow +local isProcessing = false + function Extension.HookFrame(frame) if not frame or hookedFrames[frame] then return end @@ -24,14 +27,20 @@ function Extension.HookFrame(frame) local onLeave = frame:GetScript("OnLeave") frame:SetScript("OnEnter", function() - if this.unit then + if not isProcessing and this.unit then + isProcessing = true CleveRoids.SetMouseoverFrom("luna", this.unit) + isProcessing = false end if onEnter then onEnter() end end) frame:SetScript("OnLeave", function() - CleveRoids.ClearMouseoverFrom("luna") + if not isProcessing then + isProcessing = true + CleveRoids.ClearMouseoverFrom("luna") + isProcessing = false + end if onLeave then onLeave() end end) @@ -107,8 +116,8 @@ function Extension.DelayedInit() -- Re-hook when units are loaded/reloaded if LunaUF.Units and LunaUF.Units.InitializeFrame then local origInit = LunaUF.Units.InitializeFrame - LunaUF.Units.InitializeFrame = function(self, ...) - local result = origInit(self, ...) + LunaUF.Units.InitializeFrame = function(self, unitType) + local result = origInit(self, unitType) -- Delay slightly to let frame be fully created Extension.HookAllFrames() return result diff --git a/Extensions/Mouseover/XPerl.lua b/Extensions/Mouseover/XPerl.lua index 5388f0e..ec82acc 100644 --- a/Extensions/Mouseover/XPerl.lua +++ b/Extensions/Mouseover/XPerl.lua @@ -11,17 +11,26 @@ local CleveRoids = _G.CleveRoids or {} local Extension = CleveRoids.RegisterExtension("XPerl") Extension.RegisterEvent("ADDON_LOADED", "OnLoad") +-- Re-entrancy guard to prevent stack overflow +local isProcessing = false + -- X-Perl uses XPerl_PlayerTip(unitid) for OnEnter and XPerl_PlayerTipHide() for OnLeave -- We hook these functions to track mouseover function Extension.OnEnter(unitid) + if isProcessing then return end if unitid and unitid ~= "" then + isProcessing = true CleveRoids.SetMouseoverFrom("xperl", unitid) + isProcessing = false end end function Extension.OnLeave() + if isProcessing then return end + isProcessing = true CleveRoids.ClearMouseoverFrom("xperl") + isProcessing = false end function Extension.OnLoad()