fix: prevent minimap-button C stack overflow, guard legacy options

The custom minimap-button hider re-HookScript'd OnEnter/OnLeave on every
button each 1s ticker cycle and re-hooked the Minimap OnUpdate on every
mouse enter. HookScript chains closures, so the handler chain grew until
firing it overflowed the C stack. Hook each button and the OnUpdate driver
only once via guard flags.

Also guard InterfaceOptionsControlsPanelAutoLootCorpse, absent on the CoA
client's reworked Controls panel.
This commit is contained in:
2026-05-22 21:05:29 +02:00
parent 0e232e1e81
commit a92f266a4b
+20 -4
View File
@@ -2228,11 +2228,18 @@ function LeaPlusLC:Isolated()
--===== Disable Auto Loot button in Interface menu and add tooltip to it. =====--
-- if aura_env.config["autoLootGlobalEnabled"] then
InterfaceOptionsControlsPanelAutoLootCorpse:Disable()
-- The CoA client's reworked Controls panel may not expose
-- these legacy globals; guard each access so a missing widget
-- cannot abort the login event handler.
if InterfaceOptionsControlsPanelAutoLootCorpse then
InterfaceOptionsControlsPanelAutoLootCorpse:Disable()
end
local autoLootText = InterfaceOptionsControlsPanelAutoLootCorpseText
autoLootText:SetText("Auto Loot option is controlled by Leatrix Plus.")
autoLootText:SetAlpha(0.6)
if autoLootText then
autoLootText:SetText("Auto Loot option is controlled by Leatrix Plus.")
autoLootText:SetAlpha(0.6)
end
-- print("Auto Loot Set")
@@ -6084,7 +6091,12 @@ function LeaPlusLC:Player()
-- Set hover scripts for all buttons
local function SetupButtonHoverScripts()
for _, button in pairs(minimapButtons) do
if button then
-- Hook each button only once. The ticker below runs every
-- second; HookScript chains its closures, so re-hooking each
-- cycle accumulates hundreds of nested handlers and eventually
-- overflows the C stack when OnEnter/OnLeave fires.
if button and not button.leaPlusHoverHooked then
button.leaPlusHoverHooked = true
button:HookScript("OnEnter", function()
-- Show all buttons when hovering over one
for _, btn in pairs(minimapButtons) do
@@ -6192,6 +6204,10 @@ function LeaPlusLC:Player()
-- This function is called when the mouse enters the minimap area.
local function Minimap_OnEnter()
-- Install the OnUpdate driver only once. Hooking it on every
-- minimap enter chains closures and overflows the C stack.
if Minimap.leaPlusHideButtonsOnUpdate then return end
Minimap.leaPlusHideButtonsOnUpdate = true
-- If the mouse is over a child, we show all minimap buttons.
Minimap:HookScript("OnUpdate", function(self, elapsed)
local numChildren = Minimap:GetNumChildren()