These forums are in read-only mode. Please see this news post for more information.

New forums can be found here


Go Back   WowAce Forums > General > Lua Code Discussion
Lua Code Discussion You scared? Terrified. Mortified. Petrified. Stupefied... by [coding].

Reply
 
Thread Tools
Old 09-02-2008   #1
astaldo2
Hero Member
 
Join Date: Sep 2008
Posts: 601
Default [WotLK] UIDropDownMenu woes - taint (8885)

It seems that in the recent 3.0.2 (8885) beta build any addon that calls
Code:
UIDropDownMenu_Initialize(frame, initfunc, ...)
causes action blocked errors due to taint.

Steps to reproduce:
1. Load an addon that uses UIDropDownMenu_Initialize and take whatever action is required for the function to be called
(show an options screen etc)
2. Right-click the target frame and choose "Set Focus"
Similar issues with "Clear Focus".

Both setfocus and clearfocus work without issue if you use keybinds and not the dropdown menu.

Typical taint.log contains:
Code:
Global variable UIDROPDOWNMENU_INIT_MENU tainted by _ _ _ _ _ 
Interface\FrameXML\UIDropDownMenu.lua:30 UIDropDownMenu_Initialize()
...
Execution tainted by _ _ _ _ _ while reading UIDROPDOWNMENU_INIT_MENU - 
Interface\FrameXML\UnitPopup.lua:997 func()
...
An action was blocked because of taint from _ _ _ _ _ - FocusUnit()
Interface\FrameXML\UnitPopup.lua:1181 func()
Several addons are giving me those messages.
Those that initialize the dropdown in OnLoad handlers are blamed first.
If you go on disabling, other addons take their place after they call UIDropDownMenu_Initialize
(in OnShow handlers for example)

Haven't found a workaround sofar or a mention on UI & Macros forum so
I don't know if this is expected behavior we're supposed to circumvent somehow.

Edit: Addons in question use local variables btw (self not this) and the action blocked errors
happen regardless of combat status (both when trying to setfocus and showing dropdowns)
ie you'll get them even if you haven't entered combat at all.
astaldo2 is offline   Reply With Quote
Old 09-02-2008   #2
Tristanian
Senior Member
 
Tristanian's Avatar
 
Join Date: Dec 2006
Posts: 422
Default Re: [WotLK] UIDropDownMenu woes - taint (8885)

Confirming this 100%. I've spend hours trying to troubleshoot and find out what was causing the taint, since I do not call any Blizzard protected function in my dropdowns. Turns out that UIDropDownMenu_Initialize is causing it for certain init functions (not ALL menus taint, but most do, especially if you try to do something more complicated than adding a couple of menu items and I haven't been able to track the 'conditions' that will trigger the taint). If you disable the Dropdown initialization for any menu, everything works fine.

The reason the taint is caused when selecting 'Set Focus' from the playerframe dropdown is the fact that the specific menu item is eventually calling a protected function (specifically FocusUnit), or maybe that it is tied to a SecureUnitButton (not really sure), fact remains that unless there is something we are missing, currently any addon that uses Blizzard's UIDropDownTemplate has a chance to taint that menu. If you invoke the focus frame from the slash handler (/focus) everything works fine.

"I don't know if this is expected behavior we're supposed to circumvent somehow."

Me neither. Perhaps use a secure template somehow or securely hook a few functions ? I'm pretty lost myself. Oh and it doesn't matter much if you use self or this, tested both, both result in the taint.
Tristanian is offline   Reply With Quote
Old 09-02-2008   #3
Tristanian
Senior Member
 
Tristanian's Avatar
 
Join Date: Dec 2006
Posts: 422
Default Re: [WotLK] UIDropDownMenu woes - taint (8885)

All righty, I think I've nailed it down to a rather old "bug" (?), reported in the UI and Macros forum.

Code:
function MyTest2_DropDown_InitButtons()

	DEFAULT_CHAT_FRAME:AddMessage("UIDROPDOWNMENU_MAXBUTTONS = " .. UIDROPDOWNMENU_MAXBUTTONS);

	-- Create one more menu button than the current maximum.

	local num = UIDROPDOWNMENU_MAXBUTTONS + 1;

	local info;

	for i = 1, num do

		info = UIDropDownMenu_CreateInfo();

		info.text = "Menu item" .. i;

		UIDropDownMenu_AddButton(info);

	end

end



function MyTest2_Init()

	CreateFrame("Frame", "MyTest2", UIParent);

	CreateFrame("Frame", "MyTest2_DropDown", MyTest2, "UIDropDownMenuTemplate");

	UIDropDownMenu_Initialize(MyTest2_DropDown, MyTest2_DropDown_InitButtons, "MENU");

end



MyTest2_Init();
Disable or delete all addons and create a new one, using the above code. 'Set Focus' will produce a taint. Then change the num variable to UIDROPDOWNMENU_MAXBUTTONS - 1, reloadUI, 'Set Focus', no taint (this was tested in the 8885 build). Apparently, if you create a UIDropDownMenu containing more menu items than the number of menu item buttons that the game has already created, it can cause this sort of behavior.
Tristanian is offline   Reply With Quote
Old 09-02-2008   #4
astaldo2
Hero Member
 
Join Date: Sep 2008
Posts: 601
Default Re: [WotLK] UIDropDownMenu woes - taint (8885)

Good catch.

As you noted on wowi though it doesn't solve our problem...
the only way to be safe would be to only create dropdowns with up to 8 menu buttons
(the initial UIDROPDOWNMENU_MAXBUTTONS value in-game)

I hope they fix it.
astaldo2 is offline   Reply With Quote
Old 09-02-2008   #5
Tristanian
Senior Member
 
Tristanian's Avatar
 
Join Date: Dec 2006
Posts: 422
Default Re: [WotLK] UIDropDownMenu woes - taint (8885)

While the global is set to 8 initially, I believe that you can "safely" add as much as 16, judging from my tests.
Tristanian is offline   Reply With Quote
Old 01-23-2009   #6
HunterZ
Legendary Member
 
HunterZ's Avatar
 
Join Date: Dec 2005
Posts: 3,368
Default Re: [WotLK] UIDropDownMenu woes - taint (8885)

Any idea if this taint bug was fixed by Blizz in 3.0.8? I heard they changed something related to dropdowns.
HunterZ is offline   Reply With Quote
Old 01-23-2009   #7
Tristanian
Senior Member
 
Tristanian's Avatar
 
Join Date: Dec 2006
Posts: 422
Default Re: [WotLK] UIDropDownMenu woes - taint (8885)

It is, at least for the vast majority of addons that were simply initializing a menu and only reading some globals. There are still some issues however with addons "inserting" menu items, for instance Chatter's AltNames module is producing a taint because of this (or used to when I tested it on the PTR). Most Unitframe addons also seem to be still affected by this, but I haven't really digged on the code to know more.
Tristanian is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

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

Forum Jump


All times are GMT. The time now is 06:17 AM.