Thread Tools Display Modes
12-17-20, 06:55 PM   #1
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 320
Mysterious taint for changing a drop down selection?

Hi,

my addon DynamicCam is almost useless without the ActionCam. The newly introduced accessibility feature "keep character centered" disables the ActionCam, so I want to prevent users from enabling it. However, I want to inform users what is happening, which is why I modified the Interface->Accessibility->Motion Sickness drop down like this.
(This is just the front end part of my solution, I am changing the cvars with another hook, which however is not required to reproduce the error I am getting.)

Lua Code:
  1. -- Automatically set the dropdown list to an allowed value.
  2. hooksecurefunc("UIDropDownMenu_SetSelectedValue", function(menu, value)
  3.   if menu == InterfaceOptionsAccessibilityPanelMotionSicknessDropdown then
  4.    
  5.     if value == 1 then
  6.  
  7.       print("Debug: 1 not allowed, switching to 4...")
  8.       InterfaceOptionsAccessibilityPanelMotionSicknessDropdown.value = 4
  9.       InterfaceOptionsAccessibilityPanelMotionSicknessDropdown.selectedValue = 4
  10.  
  11.     elseif value == 3 then
  12.  
  13.       print("Debug: 3 not allowed, switching to 2...")
  14.       InterfaceOptionsAccessibilityPanelMotionSicknessDropdown.value = 2
  15.       InterfaceOptionsAccessibilityPanelMotionSicknessDropdown.selectedValue = 2
  16.  
  17.     end
  18.    
  19.   end
  20. end)

I also used UIDropDownMenu_SetSelectedValue() to set the values before, but because of the strange error I am experiencing I switched to just setting value and selectedValue; but the error remains. Here is how to reproduce it:
  1. Go into combat.
  2. Open the game menu (click the button, do not press ESC which would exit combat).
  3. Click on "Interface".
  4. Chose the "Accessibilty" tab of the "Interface" window.
  5. Click the "Motion Sickness" dropdown.
  6. Select one of the two options including "Keep Character Centered" (observe that it is automatically changed as expected).
  7. Click the "Motion Sickness" dropdown again!
  8. Select any option!
  9. Press the "Cancel" button in the bottom right of the "Interface" window.

You now get an "Interface action failed because of an AddOn" error.
With BugSack I was able to identify what's happening:

Code:
[ADDON_ACTION_BLOCKED] AddOn 'MinimalWorkingExample' tried to call the protected function 'CompactRaidFrameContainer:Hide()'.
[string "@!BugGrabber\BugGrabber.lua"]:519: in function <!BugGrabber\BugGrabber.lua:519>
[string "=[C]"]: in function `Hide'
[string "@Blizzard_CompactRaidFrames\Blizzard_CompactRaidFrameManager.lua"]:530: in function `CompactRaidFrameManager_UpdateContainerVisibility'
[string "@Blizzard_CompactRaidFrames\Blizzard_CompactRaidFrameManager.lua"]:475: in function <...mpactRaidFrames\Blizzard_CompactRaidFrameManager.lua:464>
[string "@Blizzard_CompactRaidFrames\Blizzard_CompactRaidFrameManager.lua"]:514: in function `CompactRaidFrameManager_SetSetting'
[string "@Blizzard_CUFProfiles\Blizzard_CompactUnitFrameProfiles.lua"]:594: in function `func'
[string "@Blizzard_CUFProfiles\Blizzard_CompactUnitFrameProfiles.lua"]:571: in function `CompactUnitFrameProfiles_ApplyProfile'
[string "@Blizzard_CUFProfiles\Blizzard_CompactUnitFrameProfiles.lua"]:174: in function `CompactUnitFrameProfiles_ApplyCurrentSettings'
[string "@Blizzard_CUFProfiles\Blizzard_CompactUnitFrameProfiles.lua"]:83: in function `CompactUnitFrameProfiles_CancelChanges'
[string "@Blizzard_CUFProfiles\Blizzard_CompactUnitFrameProfiles.lua"]:76: in function <...rd_CUFProfiles\Blizzard_CompactUnitFrameProfiles.lua:74>
[string "=[C]"]: in function `pcall'
[string "@FrameXML\InterfaceOptionsFrame.lua"]:215: in function <FrameXML\InterfaceOptionsFrame.lua:214>
[string "=[C]"]: ?
[string "@FrameXML\InterfaceOptionsFrame.lua"]:250: in function <FrameXML\InterfaceOptionsFrame.lua:246>
So it all starts with InterfaceOptionsFrameCancel_OnClick() and eventually tries to hide CompactRaidFrameContainer, which is apparently protected in combat.


I would have many questions regarding this:
  1. I always thought taint is only created when an addon calls functions. But apparently it is also created by just assigning variables?
  2. How is the taint passed on in this case? It is not my addon calling InterfaceOptionsFrameCancel_OnClick().
  3. Why are steps 7. and 8. in my description to reproduce the error even necessary?
  4. If there is no solution to this taint problem, maybe somebody has a better idea to achieve what I initially wanted?

Thank you all in advance!
__________________
~ Be the change you want to see in the world... of warcraft interface! ~

Last edited by LudiusMaximus : 12-17-20 at 07:03 PM.
  Reply With Quote
12-17-20, 11:57 PM   #2
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
https://www.wowinterface.com/forums/...019#post336019
__________________
  Reply With Quote
12-18-20, 11:47 AM   #3
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 320
Thanks! This explains a lot, but it also seems like there is not much I can do to resolve this. Maybe I can hide the drop down and replace it with my own. Will give this a try.
__________________
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote
12-18-20, 04:49 PM   #4
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Maybe, or just put a big red warning label next to it.
__________________
  Reply With Quote
12-19-20, 12:03 PM   #5
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 320
All right, I built my own drop down list, hoping that I can use this without spreading taint.

But it turns out that even this miminal example spreads the taint:

Lua Code:
  1. local myDropdown = CreateFrame("Frame", "myDropdown", UIParent, "UIDropDownMenuTemplate")
  2. myDropdown:SetPoint("TOP")
  3. UIDropDownMenu_SetWidth(myDropdown, 130)
  4.  
  5. local function MyDropdown_Initialize()
  6.  
  7.   local info = UIDropDownMenu_CreateInfo()
  8.  
  9.   info.text = "test"
  10.   info.value = 1
  11.   UIDropDownMenu_AddButton(info)
  12.  
  13.   info.value = 2
  14.   UIDropDownMenu_AddButton(info)
  15.  
  16.   info.value = 3
  17.   UIDropDownMenu_AddButton(info)
  18.  
  19.   info.value = 4
  20.   info.checked = true
  21.   UIDropDownMenu_AddButton(info)
  22.  
  23. end
  24.  
  25. UIDropDownMenu_Initialize(myDropdown, MyDropdown_Initialize)


You get the error like this:
  1. Go into combat.
  2. Open the game menu (click the button, do not press ESC which would exit combat).
  3. Click on "Interface".
  4. Chose the "Accessibilty" tab of the "Interface" window.
  5. Click my drop down menu at the top of the (UIParent) screen.
  6. Click the "Cancel" button in the bottom right of the "Interface" window.

Is this bugged or am I doing anything wrong?
__________________
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote
12-23-20, 03:58 AM   #6
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 320
I think I got it working now.

Made my own local copy of UIDropDownMenu_AddButton()
and found out that the taint is not spread if I remove the line
Code:
button.checked = info.checked;
__________________
~ Be the change you want to see in the world... of warcraft interface! ~
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Mysterious taint for changing a drop down selection?

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