Better Wardrobe and Transmog

Better Wardrobe and Transmog

6M Downloads

Corrupting UIDropDownMenu globally

mbattersby opened this issue ยท 1 comments

commented

I don't know how, but the combination of BetterWardrobe and BetterWardrobe_Tooltip is messing up UIDropDownMenu for all addons loaded after them. Possibly it's not safe load the collections UI from unsafe code.

The symptom is that on popping out a level 2 dropdown the values of all the level 1 dropdown options are set to false or nil, so even if they are checked clicking them turns them on.

Below is example code that shows the problem. Run this after loading your two BetterWardrobe and BetterWardrobe_Tooltip. Then click on the filter button to open the menu, move down to make the second level popout appear, then move back up to click on "Option 1". You will see it does not click the first time.

If you run it without your two addons loaded, it behaves as expected.

local options = { true, true}

local function DDInit(self, level)
   local info = UIDropDownMenu_CreateInfo()
   info.isNotRadio = true
   info.keepShownOnClick = true
   
   if level == 1 then
      info.text = 'Option 1'
      info.func = function (_, _, _, v) options[1] = v end
      info.checked = function () return options[1] end
      UIDropDownMenu_AddButton(info, level)
      
      info.text = 'Submenu'
      info.func = nil
      info.hasArrow = true
      info.notCheckable = true
      UIDropDownMenu_AddButton(info, level)
   elseif level == 2 then
      info.text = 'Option 2'
      info.func = function (_, _, _, v) options[2] = v end
      info.checked = function () return options[2] end
      UIDropDownMenu_AddButton(info, level)
   end
end

local b = CreateFrame('DropDownToggleButton', nil, UIParent, "UIMenuButtonStretchTemplate")

b:SetSize(96, 22)
b:ClearAllPoints()
b:SetPoint('CENTER')
b:SetText(FILTER)
b:Show()

local d = CreateFrame('Frame', nil, nil, "UIDropDownMenuTemplate")
UIDropDownMenu_Initialize(d, DDInit, "MENU")


b:SetScript('OnClick', function (self) ToggleDropDownMenu(1, nil, d, self) end)
commented

The next version is using a custom library to prevent the dropdown taint and fixes the issues that you describe.