Stanzilla / WoWUIBugs

World of Warcraft UI Bug Tracker
153 stars 7 forks source link

MasterLooterFrame errors if shown with lootUnderMouse CVar set to "1" #555

Open Meorawr opened 2 months ago

Meorawr commented 2 months ago

If the lootUnderMouse CVar is set to "1" then an error will occur whenever the master loot frame is shown.

5x FrameXML/LootFrame.lua:573: Action[SetPoint] failed because[SetPoint would result in anchor family connection]: attempted from: MasterLooterFrame:SetPoint.
[string "=[C]"]: in function `SetPoint'
[string "@FrameXML/LootFrame.lua"]:573: in function `MasterLooterFrame_Show'
[string "@FrameXML/LootFrame.lua"]:98: in function <FrameXML/LootFrame.lua:24>
[string "=[C]"]: in function `LootSlot'
[string "@FrameXML/LootFrame.lua"]:351: in function `LootButton_OnClick'
[string "*LootFrame.xml:42_OnClick"]:4: in function <[string "*LootFrame.xml:42_OnClick"]:1>

With that CVar enabled, LootFrame anchors to the screen rather than to UIParent. MasterLooterFrame is created with an initial anchor to UIParent. After clicking a loot slot, the MasterLooterFrame attempts to add an additional anchor to a child button of the LootFrame - which creates a cross-family anchor situation between the screen and UIParent, and thus violates the whole "cannot form a connection between anchor families" rule.

Resolving this just requires adding a single ClearAllPoints call prior to the SetPoint call in MasterLooterFrame_Show:

diff --git a/Interface/AddOns/Blizzard_UIPanels_Game/Classic/LootFrame.lua b/Interface/AddOns/Blizzard_UIPanels_Game/Classic/LootFrame.lua
index 03dae39b..94bea859 100644
--- a/Interface/AddOns/Blizzard_UIPanels_Game/Classic/LootFrame.lua
+++ b/Interface/AddOns/Blizzard_UIPanels_Game/Classic/LootFrame.lua
@@ -570,6 +570,7 @@ function MasterLooterFrame_Show(selectedLootButton)

    MasterLooterFrame:Show();
    MasterLooterFrame_UpdatePlayers();
+   MasterLooterFrame:ClearAllPoints();
    MasterLooterFrame:SetPoint("TOPLEFT", selectedLootButton, "BOTTOMLEFT", 0, 0);

    CloseDropDownMenus();