Thread Tools Display Modes
04-30-12, 11:11 AM   #1
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
secure actionbutton taints again :(

Lua Code:
  1. local _,class = UnitClass('player')
  2. local xoffset, yoffset = 8,0
  3.  
  4. local function createBar(bid,id)
  5.     local f = CreateFrame("Frame", "zzABar"..bid, UIParent, "SecureHandlerStateTemplate",id)
  6.     f:SetWidth(1)
  7.     f:SetHeight(1)
  8.     f:SetPoint("CENTER")
  9.     f:SetAttribute('_onstate-page', [[
  10.         print(newstate)
  11.         self:SetAttribute('actionpage', newstate)
  12.         control:ChildUpdate('actionpage', newstate)
  13.     ]])
  14.     if(class == "WARRIOR") then
  15.         print("war")
  16.         RegisterStateDriver(f, "page", "[bonusbar:1] 7;[bonusbar:2] 8;[bonusbar:3] 9;1")
  17.     end
  18.    
  19.     local lastbutton = f
  20.     for i = 1, 12 do
  21.         local b = CreateFrame("CheckButton", "$PARENTActionButton"..i, f, "SecureActionButtonTemplate ActionButtonTemplate",i)
  22.         b:SetWidth(32)
  23.         b:SetHeight(32)
  24.         b:SetPoint("TOPLEFT", lastbutton, "TOPRIGHT", xoffset, yoffset)
  25.         lastbutton = b
  26.         ActionButton_OnLoad(b)
  27.         b:SetAttribute('action--base',i)
  28.         b:SetAttribute('showgrid', 1)
  29.         b:SetAttribute('_childupdate-actionpage', [[
  30.             local offset = (message -1) * 12 + self:GetAttribute('action--base')
  31.             self:SetAttribute('action', self:GetAttribute('action--base'))
  32.             print(message, offset, self:GetAttribute('action--base'))
  33.         ]])
  34.         b:SetScript("OnAttributeChanged",ActionButton_UpdateAction)
  35.         b:SetAttribute('action', i)
  36.  
  37.     end
  38. end

I try to have a bar that switches automaticly. The code above works but I get taints over and over.

Code:
4/30 18:55:05.677  An action was blocked in combat because of taint from zz_Actionbuttons - zzABar1ActionButton1:Show()
4/30 18:55:05.677      Interface\FrameXML\ActionButton.lua:246 ActionButton_Update()
4/30 18:55:05.677      Interface\FrameXML\ActionButton.lua:484 ActionButton_OnEvent()
4/30 18:55:05.677      Interface\FrameXML\ActionButton.lua:105
But I have no clue what I should do to make my code secure.
Someone got an easy example how this works ? Looked at BT and Dominos but thats a little above my skills
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
04-30-12, 12:42 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,327
The taint is generated because calls to frame:Show() or frame:Hide() are blocked if used on a protected frame while in combat. There is a way around this using SecureStateDrivers, but this is for very specific reasons.

This might be caused by either of the links to Blizzards functions you have. ActionButton_OnLoad() or ActionButton_UpdateAction(). From the taint path, it looks to be the first.



Something you might try is use XML to create a template and use the following in between the <Scripts> tags:
Code:
<OnLoad function="ActionButton_OnLoad"/>
Then reference the template in your CreateFrame() call and set up the rest.

I'm not entirely sure if taint would be passed on to the OnLoad script, but it's worth a try.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 04-30-12 at 01:00 PM.
  Reply With Quote
04-30-12, 03:29 PM   #3
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
I create from CheckButtonTemplate (ActionBarFrame.xml)... not sure why, but my code only works if
I use the two (same for OnAttributeChanged) again event though the template has both defined.

Lua Code:
  1. <CheckButton name="ActionBarButtonCodeTemplate" inherits="SecureActionButtonTemplate" virtual="true">
  2.         <Scripts>
  3.             <OnLoad>
  4.                 ActionButton_OnLoad(self);
  5.             </OnLoad>
  6.             <OnAttributeChanged>
  7.                 ActionButton_UpdateAction(self, name, value);
  8.             </OnAttributeChanged>
  9.             <OnEvent>
  10.                 ActionButton_OnEvent(self, event, ...);
  11.             </OnEvent>
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
04-30-12, 03:36 PM   #4
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
grml ... posting it helps

I forgot to use ActionBarButtonCodeTemplate for the CheckButton inherit.
Thank you helping me looking at it from a different view
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » secure actionbutton taints again :(


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