WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Taint when using ActionButtonTemplate (https://www.wowinterface.com/forums/showthread.php?t=57023)

Ethly 02-16-19 09:08 AM

Taint when using ActionButtonTemplate
 
Here's the simplest code that reproduces this bug:
Code:

<CheckButton name="MUShieldSlam" parent="UIParent" inherits="ActionButtonTemplate">
        <Anchors>
                <Anchor point="CENTER"/>
        </Anchors>
        <Attributes>
                <Attribute name="action" value="2"/>
        </Attributes>
        <Scripts>
                <OnLoad function="ActionButton_OnLoad"/>
        </Scripts>
</CheckButton>

With this code I'm getting the following error whenever any debuff applied:
Code:

8x [ADDON_ACTION_BLOCKED] Аддон 'MyUI' tried to call protected function 'MainMenuBar:SetPoint()'.
!BugGrabber\BugGrabber.lua:519: in function <!BugGrabber\BugGrabber.lua:519>
[C]: in function `SetPoint'
FrameXML\UIParent.lua:2981: in function `UIParentManageFramePositions'
FrameXML\UIParent.lua:2357: in function <FrameXML\UIParent.lua:2344>
[C]: in function `SetAttribute'
FrameXML\UIParent.lua:3153: in function `UIParent_ManageFramePositions'
FrameXML\BuffFrame.lua:332: in function `BuffFrame_UpdateAllBuffAnchors'
FrameXML\BuffFrame.lua:104: in function `BuffFrame_Update'
FrameXML\BuffFrame.lua:49: in function <FrameXML\BuffFrame.lua:45>

Locals:
InCombatSkipped

What am I doing wrong? I tried to understand this stacktrace but I have no idea how it has any relation to my code. I tried to inherit from SecureActionButtonTemplate (I don't really need it, but anyway) and it did not help.

Ethly 02-16-19 12:34 PM

I solved it by inheriting from ActionBarButtonTemplate. Unfortunately I couldn't figure out how I could use OnLoad without tainting things, so I did initialization from a completely different frame. It seems to work for now. I'd be thankful if there's simpler way to do so. Here's the code:
Code:

        <CheckButton name="MUShieldSlam" parent="UIParent" inherits="ActionBarButtonTemplate">
                <Size x="28" y="28"/>
                <Anchors>
                        <Anchor point="BOTTOMLEFT" relativeTo="PlayerFrame" relativePoint="TOPLEFT" x="75" y="0"/>
                </Anchors>
                <Attributes>
                        <Attribute name="action" value="2"/>
                </Attributes>
        </CheckButton>
       
        <Frame>
                <Scripts>
                        <OnLoad function="MUEvents_OnLoad"/>
                </Scripts>
        </Frame>

Code:

function MUEvents_OnLoad(self)
        print("MUEvents_OnLoad");
        MUShieldSlam:EnableMouse(false);
        MUShieldSlam:SetNormalTexture(nil);
end


Resike 02-16-19 01:11 PM

Have you tried using `SecureActionButtonTemplate`?

Ethly 02-16-19 03:09 PM

Quote:

Originally Posted by Resike (Post 331565)
Have you tried using `SecureActionButtonTemplate`?

Yes, it did not help.

kurapica.igas 02-16-19 08:57 PM

For the code

Code:

<CheckButton name="MUShieldSlam" parent="UIParent" inherits="ActionButtonTemplate">
        <Anchors>
                <Anchor point="CENTER"/>
        </Anchors>
        <Attributes>
                <Attribute name="action" value="2"/>
        </Attributes>
        <Scripts>
                <OnLoad function="ActionButton_OnLoad"/>
        </Scripts>
</CheckButton>

I think the problem is you can't use the ActionButton_OnLoad in your xml directly, you may use the ActionBarButtonCodeTemplate instead of the ActionButtonTemplate.


For the second, if you don't want override the template's onload, you can use inherit="prepend" in your frame, here is an example:

Code:

<Ui>
        <Frame name="TestFrameTemplate" hidden="true" virtual="true">
                <Scripts>
                        <OnLoad>
                                print("TestFrameTemplat loaded")
                        </OnLoad>
                </Scripts>
        </Frame>
        <Frame name="TestFrame" inherits="TestFrameTemplate">
                <Scripts>
                        <OnLoad inherit="prepend">
                                print("TestFrame loaded")
                        </OnLoad>
                </Scripts>
        </Frame>
</Ui>

The result will be:

TestFrameTemplat loaded
TestFrame loaded


All times are GMT -6. The time now is 04:25 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI