• 0

    posted a message on Fixing the Interface Options Cancel button taint
    The problem
    Ever noticed that if you open the interface options and then click cancel whilst in combat, everything blows up? It will throw taint errors and randomly blame any addon that has added a config panel to the Interface Options. This thread is about investigating this taint.

    Maybe this rings a bell?
    1x [ADDON_ACTION_BLOCKED] AddOn 'Skada' tried to call the protected function 'CompactRaidFrameContainer:Show()'.
    The story
    The issue is with the InterfaceOptionsFrame_OnShow function.
    function InterfaceOptionsFrame_OnShow (self)
        InterfaceCategoryList_Update();
        [B]InterfaceAddOnsList_Update[/B](); -- Problematic
        if ( not InterfaceOptionsFramePanelContainer.displayedPanel ) then
            InterfaceOptionsFrame_OpenToCategory(CONTROLS_LABEL);
        end
        InterfaceOptionsOptionsFrame_RefreshCategories();
        InterfaceOptionsOptionsFrame_RefreshAddOns();
    end
    Currently due to the order of these functions calls, the execution path becomes tainted after the call to InterfaceAddOnsList_Update.

    This is a large function contained in InterfaceOptionsFrame.lua line 137.

    This function ultimately goes on to call OptionsList_DisplayButton which is at line 84 of OptionsFrameTemplates.lua. Which changes the text of the button viewed in the Interface Options panel to yourAddonFrame.name which everyone taints when adding a config panel to the Interface Options.

    button.text:SetText(element.name);
    Reproducing the issue with 0 addons
    Run the following script >> get into combat (with a target dummy) >> open the interface options >> click cancel >> action blocked
    /script local p=CreateFrame("Frame");p.name="Test";InterfaceOptions_AddCategory(p)
    Temporary solution
    do
        local ufUpdate, abUpdate, abeUpdate
        local f = CreateFrame("Frame")
    
        local ufWrapper = CompactUnitFrameProfiles_CancelChanges
        CompactUnitFrameProfiles_CancelChanges = function(self)
            if not InCombatLockdown() then
                ufWrapper(self)
            else
                ufUpdate = self
                f:RegisterEvent("PLAYER_REGEN_ENABLED")
            end
        end
    
        local abWrapper = InterfaceOptions_UpdateMultiActionBars
        InterfaceOptions_UpdateMultiActionBars = function()
            if not InCombatLockdown() then
                abWrapper()
            else
                abUpdate = true
                f:RegisterEvent("PLAYER_REGEN_ENABLED")
            end
        end
        InterfaceOptionsActionBarsPanelBottomLeft.setFunc = InterfaceOptions_UpdateMultiActionBars
        InterfaceOptionsActionBarsPanelBottomRight.setFunc = InterfaceOptions_UpdateMultiActionBars
        InterfaceOptionsActionBarsPanelRight.setFunc = InterfaceOptions_UpdateMultiActionBars
        InterfaceOptionsActionBarsPanelRightTwo.setFunc = InterfaceOptions_UpdateMultiActionBars
        InterfaceOptionsActionBarsPanelLockActionBars.setFunc = InterfaceOptions_UpdateMultiActionBars
    
        local abeWrapper = InterfaceOptionsActionBarsPanelAlwaysShowActionBars.setFunc
        InterfaceOptionsActionBarsPanelAlwaysShowActionBars.setFunc = function()
            if not InCombatLockdown() then
                abeWrapper()
            else
                abeUpdate = true
                f:RegisterEvent("PLAYER_REGEN_ENABLED")
            end
        end
    
        f:SetScript("OnEvent", function(self)
            if ufUpdate then
                ufWrapper(ufUpdate)
                ufUpdate = nil
            end
            if abUpdate then
                abWrapper()
                abUpdate = nil
            end
            if abeUpdate then
                abeWrapper()
                abeUpdate = nil
            end
            self:UnregisterEvent("PLAYER_REGEN_ENABLED")
        end)
    end
    Breakdown on my solution
    What does it do? This is basically the function that is registered to the "Raid Profiles" panel in the Interface Options to fire when the cancel button is pressed. All I'm doing is hooking said function, so that if the cancel button is pressed in combat, none of the changes are saved, until the user leaves combat. This is because the execution path is already tainted earlier, so we prevent this tainted execution path from trying to show/hide frames in combat, which results in taint errors.

    The odds of someone making changes to the raid profiles in combat and then deciding to cancel them are low. Much lower than how frequently this taint issue is occurring.

    What's next?
    I'm probably going to shove this into the LibChatAnims library. I know it's not exactly appropriately named, but it's an easy way to mass distribute a taint fix across the WoW playerbase. I should have probably just named it LibTaintFix in the first place, but it's really not that important.

    Ideally Blizzard should fix this by re-arranging the order of the function calls in InterfaceOptionsFrame_OnShow to fire the Blizzard functions first, followed by the addon functions.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Just a performance question.
    Due to Ace3 being a collection of various libraries, your "performance" will actually be worse if you use it standalone, because you are pointlessly loading libraries that your addons may not even use. In that sense, your loading time may also end up being longer.


    I personally do not recommend disembedding libraries whatsoever.
    Posted in: Ace3
  • 0

    posted a message on How to rotate a texture and fill
    If this is a cosmetic rotation (e.g. 360 degree spin) then you should be using an animation rather than coding it yourself.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Setting no outline, mono causes crash
    No, this has caused a client crash for a long time. (at least since v5, probably earlier). Blizz either doesn't know (doubtful) or doesn't care.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Can addon profiler show cpu usage when there is none?
    Bundling libraries being used by other addons?
    Tainting Blizzard global variables that are being frequently accessed?
    Posted in: AddOn HELP!
  • 0

    posted a message on Conflicts with FrameLocks
    You're overwriting the Blizzard global variable "RuneFrame", which in turn is a variable that's added to the framelocks table, that's the cause of your error. If it didn't error, it would taint like hell.

    Don't mess with anything added to that table and don't try to add anything to it.

    Whilst you're at it you should make all your functions local, they are currently global which pollutes the namespace. You're also setting a global variable called "imagetimer".
    Posted in: Lua Code Discussion
  • 0

    posted a message on LibMapPins-1.0
    I haven't looked at it but it's about time someone decided to make an Astrolabe alternative.
    Posted in: Libraries
  • 0

    posted a message on InterfaceOptionsFrame_OpenToCategory fix ?
    Quote from Adirelle
    Thanks.

    However it seems it fixed an old issue, which is different from the current one.


    I fixed in it BW by... calling it twice everywhere.
    Posted in: Addon Ideas
  • 0

    posted a message on Get The Spell Description
    Quote from Seerah
    You won't find help here with private servers.


    Closed.
    Posted in: Lua Code Discussion
  • 0

    posted a message on how to get boss level w/o targeting
    Quote from tinystomper
    i went into the stockades and tried UnitLevel("boss1") and UnitName("boss1") while standing in front of hogger ... no joy

    isn't that supposed to work? did they disable it for some reason?


    It only works when the boss health frames are showing i.e. you need to be in combat with the boss.
    Posted in: Lua Code Discussion
  • 0

    posted a message on boss events in an instance
    You can use your own list of ids, they are on wowhead e.g. Nefarian is 11583 http://www.wowhead.com/npc=11583

    To extract a mob id from a GUID:
    tonumber(("0x0..."):sub(6, 10), 16)
    Posted in: Lua Code Discussion
  • 0

    posted a message on boss events in an instance
    Yes, the death event from CLEU same as any creature.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Need help making addon Click Through
    Add a "lock" functionality that disables the mouse?
    Posted in: Need Help?
  • 0

    posted a message on BadBoy: An extremely minimal spam blocker & reporter
    Fixed in v12.022
    Posted in: General AddOns
  • 0

    posted a message on BadBoy: An extremely minimal spam blocker & reporter
    Fixed in v12.014
    Posted in: General AddOns
  • To post a comment, please or register a new account.