Quantcast
Mysterious taint for changing a drop down selection? - WoWInterface
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
12-17-20, 06:55 PM   #1
LudiusMaximus
A Frostmaul Preserver
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 278
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
 

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