From a92f266a4bde6c4d972d263f4f19907d6b5e584d Mon Sep 17 00:00:00 2001 From: Florian Berthold Date: Fri, 22 May 2026 21:05:29 +0200 Subject: [PATCH] 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. --- Leatrix_Plus.lua | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Leatrix_Plus.lua b/Leatrix_Plus.lua index 7872eac..7a8c133 100644 --- a/Leatrix_Plus.lua +++ b/Leatrix_Plus.lua @@ -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()