Thread Tools Display Modes
10-16-12, 06:20 PM   #1
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
A replacement for UIPanelButtonTemplate

Hello,

I'm looking for a replacement for UIPanelButtonTemplate, since for some strange reason the button I use causes taint issues, probably because it's blizzard UI.
My addon uses a small toggle button (used for language selection) that can be dragged around the screen. When the user click the button, the text on the button changes.
I tried to look at AceGUI-3.0, but I didn't see there a way to create a dragable button which is displayed directly on the screen. I only saw there button widget that should be a child of a frame.

If it helps, here is the current XML code I'm using to create the button:
Code:
<Button name="hebChatLangButton" parent="UIParent" inherits="UIPanelButtonTemplate"
enableMouse="true" movable="true" frameStrata="HIGH" clampedToScreen="true">
  <Anchors>
    <Anchor point="CENTER" relativePoint="BOTTOMLEFT" relativeTo="UIParent">
      <Offset x="15" y="80"/>
    </Anchor>
  </Anchors>
  <Size x="35" y="35"/>
  <Scripts>
    <OnLoad>
      hebChat:hebChatLangButton_OnLoad(self)
    </OnLoad>		
    <OnClick>
      hebChat:toggleLanguage()
     </OnClick>
    <OnDragStart>
      self:StartMoving()
    </OnDragStart>
    <OnDragStop>
      self:StopMovingOrSizing()
    </OnDragStop>
  </Scripts>
</Button>
Thanks in advance!
  Reply With Quote
10-16-12, 07:06 PM   #2
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,359
I sincerely doubt using UIPanelButtonTemplate has anything to do with your taint problem.

Where are you using it, what are you trying to do etc...
  Reply With Quote
10-17-12, 03:43 AM   #3
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
I'm using Bugsack, this is the lua error I got with it. Looks like it starts from another addon I have, BattlegroundTargets, but the blamed addon is mine. I'm not using AlwaysUpFrame1:SetPoint(), but I do use SetPoint.

Code:
2x [ADDON_ACTION_BLOCKED] AddOn "hebChat" tried to call the protected function "AlwaysUpFrame1:SetPoint()".
!BugGrabber-r188\BugGrabber.lua:587: in function <!BugGrabber\BugGrabber.lua:587>
<in C code>
FrameXML\WorldStateFrame.lua:161: in function "WorldStateAlwaysUpFrame_Update"
FrameXML\WorldStateFrame.lua:120: in function <FrameXML\WorldStateFrame.lua:106>
<in C code>
BattlegroundTargets\BattlegroundTargets-50001-3.lua:7760: in function "BattlefieldScoreRequest"
BattlegroundTargets\BattlegroundTargets-50001-3.lua:6661: in function <BattlegroundTargets\BattlegroundTargets.lua:6648>

Locals:
nil
  Reply With Quote
10-17-12, 03:53 AM   #4
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,359
This taint error is not helpful at all to guess what the issue might be.

I doubt your addon has anything to do with the AlwaysUpFrame and there's not enough info to suggest where the problem might be starting.

There's definitely nothing pointing at UIPanelButtonTemplate.

Does it happen with only your addon enabled?
  Reply With Quote
10-17-12, 07:58 AM   #5
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
I went to BG with just 3 addons: my addon (hebChat), BugSack and Bartender.
During the BG I used my addon and clicked the button several times, including during combat. I got no error.

But then, after the BG was finished, I opened the Glyphs panel and clicked on a glyph (was trying to reproduce an error I was told about), and I indeed got an error. You can see it on the attached picture, it's related to onclick().

I have two OnClick on my addon:
1. UIPanelButtonTemplate - this is the button the thread is about, which I clicked several times during the BG.
2. ChatConfigCheckButtonTemplate - two buttons in the addon config panel, which I didn't even open.

Note: my config panel also uses a UIDropDownMenuTemplate (which has internal click function on info.func), that caused me focus taint issues in the past. But I followed the advice on another thread here and didn't initialize the dropdownlist until the config panel is actually shown.

So, I suspect that the one to blame is the UIPanelButtonTemplate.

Please assist...
Attached Thumbnails
Click image for larger version

Name:	hebchat_lua_err.jpg
Views:	1188
Size:	264.1 KB
ID:	7291  
  Reply With Quote
10-17-12, 09:07 AM   #6
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
Hunting taints is a fruitless task these days ... especially if you use UIDropDownMenuTemplate in ANY way.

http://us.battle.net/wow/en/forum/topic/6413024969
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
10-17-12, 09:15 AM   #7
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
But I initialize the UIDropDownMenuTemplate only when the addon config panel is shown, not before. And on my tests, I didn't open the addon config panel.

I thought that UIPanelButtonTemplate might have the same bad behaviour, so I was looking for a way to create a button without using this template. You think it is still related to the UIDropDownMenuTemplate?
  Reply With Quote
10-17-12, 12:35 PM   #8
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
All UIPanelButtonTemplate does is create the necessary sub-widgets to make your newly-created Button look and behave in a pre-defined way.

UIDropDownMenuTemplate does the same thing, but all Frames created with it access and modify global variables which are in turn accessed and modified by secure code, which can cause blocked actions.

This is why everyone keeps saying UIPanelButtonTemplate isn't the culprit - it doesn't have the possibly catastrophic interactions UIDropDownMenuTemplate does - it just decorates and adds (local) behaviors to your Button.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
10-17-12, 02:58 PM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
? http://www.wowace.com/announcements/...lyph-ui-taint/ ?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
10-17-12, 04:54 PM   #10
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Thank you all

So the glyph error is due to the _ variable, which I once used without declaring as local.

And you think that the AlwaysUpFrame1:SetPoint() and all similar errors are related to UIDropDownMenuTemplate and not to UIPanelButtonTemplate. But I don't initialize the dropdownlist before the addon config panel is shown, so I don't understand how it can cause issues.

Is there an easy way to replace the UIDropDownMenuTemplate with another element that doesn't cause taints?

Last edited by Animor : 10-17-12 at 04:58 PM.
  Reply With Quote
10-17-12, 07:44 PM   #11
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
I have tried to get rid of the glyph error, but apparently it is caused by more than just global _

I have eliminated some of the causes. It seems to happen for my addon when new whisper is shown in a new tab and not inline. Then, what causes the problem is either of the following:
1. Hooking ChatEdit_UpdateHeader - I use it to know when chat tab is switched.
2. Hooking FCF_OpenTemporaryWindow - I use it to know when new tab/chat window is created.
3. ChatFrame_AddMessageEventFilter - I use it to modify the chat messages that are displayed on the chat frame. I'm not sure why this filter causes problems only when whisper are displayed on a new tab, and not always, but that's the situation.

Even if I leave these hooked functions empty and just call the original function, I'm getting the glyph error.
Only way to get rid of it is to comment them. However, if I comment them, my addon doesn't work.

Can someone explain this issue and suggest how to solve it?

Thanks!
  Reply With Quote
10-17-12, 10:08 PM   #12
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
How are you hooking those functions? If you are using hooksecurefunc that should not be causing taint. If you are hooking insecurely, you should switch to secure hooks unless you actually need to modify the return values or prevent the default behavior of the function.

None of the functions you listed should be breaking the glyph frame, and are not breaking the glyph frame for me, or have ever caused any apparent problems. I've been insecurely hooking FCF_OpenTemporaryWindow in PhanxChat (and other addons) for years. I'm not currently hooking ChatEdit_UpdateHeader, but I have in the past with no problems, and I believe Prat hooks it without issue. Dozens, if not hundreds, of addons use ChatFrame_AddMessageEventFilter.

You should probably post your code.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
10-18-12, 01:48 AM   #13
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Prat alone is causing the same error!

How to reproduce:
1. Interface -> Social: set "New Whispers" to be displayed on "both" inline and new tab.
2. Load only Prat (and BugSack if you wish).
3. Log in to game, whisper to yourself anything. A new tab will be opened with your whisper.
4. Hit N to open Talents, switch to Glyphs tab, click any glyph on the right side.

The result is attached.

I don't think that my addon (and I believe Prat as well) caused this error before MoP.

Edit: PhanxChat alone also causes the same error. Do the same, only load PhanxChat instead of Prat. Error is attached as well.
Attached Thumbnails
Click image for larger version

Name:	prat_glyph_error.jpg
Views:	578
Size:	304.5 KB
ID:	7294  Click image for larger version

Name:	phanxchat_glyph_error.jpg
Views:	522
Size:	611.2 KB
ID:	7295  

Last edited by Animor : 10-18-12 at 02:01 AM.
  Reply With Quote
10-18-12, 02:51 AM   #14
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Animor View Post
1. Interface -> Social: set "New Whispers" to be displayed on "both" inline and new tab.
That explains why I haven't seen any problems. I immediately disabled that feature when it was added, as I've done with pretty much every other feature/change Blizzard has added to the chat frame since Patch 3.3.5. Also, this sounds like the dropdown menu problem all over again (eg. Blizzard's taint system is horrible, and parts of their code that aren't even remotely related to anything secure can somehow taint unrelated secure things for no reason). Between those, I can't think of really any reason to bother trying to fix it. Just tell your users to turn off duplicate whisper spamming if they need to change glyphs. If anyone ever brings it up on PhanxChat, I'll tell them the same thing.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
10-18-12, 04:35 AM   #15
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Ok, fair enough. Though I was hoping you will address this error and find a solution,since I couldn't do it...
Looks likes all chat addons suffer from it, perhaps other addons as well.
  Reply With Quote
10-18-12, 06:28 AM   #16
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Originally Posted by Phanx View Post
That explains why I haven't seen any problems. I immediately disabled that feature when it was added, as I've done with pretty much every other feature/change Blizzard has added to the chat frame since Patch 3.3.5. Also, this sounds like the dropdown menu problem all over again (eg. Blizzard's taint system is horrible, and parts of their code that aren't even remotely related to anything secure can somehow taint unrelated secure things for no reason). Between those, I can't think of really any reason to bother trying to fix it. Just tell your users to turn off duplicate whisper spamming if they need to change glyphs. If anyone ever brings it up on PhanxChat, I'll tell them the same thing.
Just to let you know that the glyph error occurs also when you choose "new tab" for new whispers, not only "both". So, something is tainted when new tab is opened by the game for an incoming whisper, it's not related to duplicated whispers.
Were you able to reproduce this error?
  Reply With Quote
10-18-12, 02:28 PM   #17
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
No, but I also didn't do any testing, and don't plan to spend any time testing, for the reasons outlined in my last post.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
10-19-12, 02:10 PM   #18
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
Hi,

I have removed UIPanelButtonTemplate from my addon, I'm now using Ace3 for the addon config panel and I use it to create the drop down table.

I still use the UIPanelButtonTemplate (xml code is posted above).
I went into a BG and got again the following lua errors:
Code:
[ADDON_ACTION_BLOCKED] AddOn "hebChat" tried to call the protected function "ArenaPrepFrames:ClearAllPoints()
I got the same for ArenaPrepFrames:SetPoint(), ArenaEnemyFrames:SetPoint(), ArenaEnemyFrames:ClearAllPoints().

I don't have any explicit SetPoint() or ClearAllPoints() in my code. Could it be related to the fact that the button is dragable? Clicking on the button performs an action, but can be also used for dragging it around the screen. If not that, then what else could cause this lua error?

Any help would be much appreciated, these lua errors are driving me crazy...

Last edited by Animor : 10-19-12 at 02:21 PM.
  Reply With Quote
10-19-12, 02:30 PM   #19
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
Anything that is only remotely connected to protected functions should not be moved in an unsecure way.
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
10-19-12, 02:47 PM   #20
Animor
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Mar 2011
Posts: 136
It's just a button the toggle a boolean variable. The addon is not doing anything protected, just handling the chat.

Anyway, I've removed these lines and still got the lua error:
Code:
<OnDragStart>
   self:StartMoving()
</OnDragStart>
So I guess it's not related to the dragging.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » A replacement for UIPanelButtonTemplate

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