Quantcast Taint when using ActionButtonTemplate - WoWInterface
Thread Tools Display Modes
02-16-19, 09:08 AM   #1
Ethly
A Fallenroot Satyr
Join Date: Mar 2018
Posts: 22
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.

Last edited by Ethly : 02-16-19 at 09:30 AM.
  Reply With Quote
02-16-19, 12:34 PM   #2
Ethly
A Fallenroot Satyr
Join Date: Mar 2018
Posts: 22
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

Last edited by Ethly : 02-16-19 at 12:37 PM.
  Reply With Quote
02-16-19, 01:11 PM   #3
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,284
Have you tried using `SecureActionButtonTemplate`?
  Reply With Quote
02-16-19, 03:09 PM   #4
Ethly
A Fallenroot Satyr
Join Date: Mar 2018
Posts: 22
Originally Posted by Resike View Post
Have you tried using `SecureActionButtonTemplate`?
Yes, it did not help.
  Reply With Quote
02-16-19, 08:57 PM   #5
kurapica.igas
A Flamescale Wyrmkin
Join Date: Aug 2011
Posts: 103
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
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Taint when using ActionButtonTemplate

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off