Quantcast [PTR,7.1] Nameplate Color Change causes lua error in combat. - WoWInterface
 
Thread Tools Display Modes
10-11-16, 09:05 PM   #1
thomasjohnshannon
A Theradrim Guardian
 
thomasjohnshannon's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 60
[PTR,7.1] Nameplate Color Change causes lua error in combat.

When any addon modifies the color of the default nameplates it will cause the following error when a new nameplate is created during combat.

Code:
1x [ADDON_ACTION_BLOCKED] AddOn '!Colorz' tried to call the protected function 'SetTargetClampingInsets()'.
!BugGrabber\BugGrabber.lua:573: in function <!BugGrabber\BugGrabber.lua:573>
[C]: in function `SetTargetClampingInsets'
...eBlizzard_NamePlates\Blizzard_NamePlates.lua:221: in function `SetupClassNameplateBars'
...eBlizzard_NamePlates\Blizzard_NamePlates.lua:74: in function `OnNamePlateAdded'
...eBlizzard_NamePlates\Blizzard_NamePlates.lua:38: in function <...eBlizzard_NamePlates\Blizzard_NamePlates.lua:32>
This seems be true no matter how the code works. Directly setting the status bar color, setting DefaultCompactNamePlate(Friendly/Enemy)FrameOptions.useClassColors to true, or modifying UnitSelectionColor all cause the same error.
__________________
Thomas aka Urnn
 
10-12-16, 12:35 AM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,721
The error is pretty clear about that. The problem is not you setting the color but the addon !Colorz trying to call SetTargetClampingInsets. That function is protected now.

With 7.1 some of the nameplate related function calls become restricted.

http://us.battle.net/forums/en/wow/topic/20749494846

On that note. You can build nameplates with oUF now. http://www.wowinterface.com/forums/s...ad.php?t=54584

If you are already using oUF for your unitframes you can get rid of the second set of unit event handlers and use oUF for all units.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-12-16 at 07:36 AM.
 
10-12-16, 03:41 PM   #3
thomasjohnshannon
A Theradrim Guardian
 
thomasjohnshannon's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 60
I know about the restrictions and none of the addons that I have tested touch SetTargetClampingInsets in any way. This is the entire Colorz addon and as you can see it shouldn't be interacting with that function that is only used in NamePlateDriverMixin:SetupClassNameplateBars().

Lua Code:
  1. -- Sets manabar color for default unit frames.
  2. local function CustomManaColor(manaBar)
  3.     local powerType = UnitPowerType(manaBar.unit);
  4.  
  5.     if ( powerType == 0 ) then
  6.         manaBar:SetStatusBarColor(0,0.55,1)
  7.     end
  8. end
  9. hooksecurefunc('UnitFrameManaBar_UpdateType',CustomManaColor)
  10.  
  11. CUSTOM_FACTION_BAR_COLORS = {
  12.     [1] = {r = 1, g = 0, b = 0},
  13.     [2] = {r = 1, g = 0, b = 0},
  14.     [3] = {r = 1, g = 1, b = 0},
  15.     [4] = {r = 1, g = 1, b = 0},
  16.     [5] = {r = 0, g = 1, b = 0},
  17.     [6] = {r = 0, g = 1, b = 0},
  18.     [7] = {r = 0, g = 1, b = 0},
  19.     [8] = {r = 0, g = 1, b = 0},
  20. }
  21.  
  22. function GameTooltip_UnitColor(unit)
  23.  
  24.     local r, g, b
  25.  
  26.     if (UnitIsDead(unit) or UnitIsGhost(unit) or UnitIsTapDenied(unit)) then
  27.         r = 0.5
  28.         g = 0.5
  29.         b = 0.5
  30.     elseif (UnitIsPlayer(unit)) then
  31.         if (UnitIsFriend(unit, 'player')) then
  32.             local _, class = UnitClass(unit)
  33.             if ( class ) then
  34.                 r = RAID_CLASS_COLORS[class].r
  35.                 g = RAID_CLASS_COLORS[class].g
  36.                 b = RAID_CLASS_COLORS[class].b
  37.             else
  38.                 r = 0.60
  39.                 g = 0.60
  40.                 b = 0.60
  41.             end
  42.         elseif (not UnitIsFriend(unit, 'player')) then
  43.             r = 1
  44.             g = 0
  45.             b = 0
  46.         end
  47.     elseif (UnitPlayerControlled(unit)) then
  48.         if (UnitCanAttack(unit, 'player')) then
  49.             if (not UnitCanAttack('player', unit)) then
  50.                 r = 157/255
  51.                 g = 197/255
  52.                 b = 255/255
  53.             else
  54.                 r = 1
  55.                 g = 0
  56.                 b = 0
  57.             end
  58.         elseif (UnitCanAttack('player', unit)) then
  59.             r = 1
  60.             g = 1
  61.             b = 0
  62.         elseif (UnitIsPVP(unit)) then
  63.             r = 0
  64.             g = 1
  65.             b = 0
  66.         else
  67.             r = 157/255
  68.             g = 197/255
  69.             b = 255/255
  70.         end
  71.     else
  72.         local reaction = UnitReaction(unit, 'player')
  73.  
  74.         if (reaction) then
  75.             r = CUSTOM_FACTION_BAR_COLORS[reaction].r
  76.             g = CUSTOM_FACTION_BAR_COLORS[reaction].g
  77.             b = CUSTOM_FACTION_BAR_COLORS[reaction].b
  78.         else
  79.             r = 157/255
  80.             g = 197/255
  81.             b = 255/255
  82.         end
  83.     end
  84.  
  85.     return r, g, b
  86. end
  87.  
  88. UnitSelectionColor = GameTooltip_UnitColor
__________________
Thomas aka Urnn
 
10-12-16, 03:58 PM   #4
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,721
This line is giving you the error:
https://github.com/tomrus88/Blizzard...lates.lua#L221
Called here:
https://github.com/tomrus88/Blizzard...Plates.lua#L74
From here:
https://github.com/tomrus88/Blizzard...Plates.lua#L38

You manipulate a Blizzard global making all secure code accessing that global insecure. This results in an error in secure environment.

Btw ... that is an error from a taint right? (Interface action blocked etc...)
If it is a taint the error can come from anywhere.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 10-12-16 at 04:02 PM.
 
10-12-16, 05:01 PM   #5
thomasjohnshannon
A Theradrim Guardian
 
thomasjohnshannon's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 60
I made a quick video to show what is going on. In Colorz if I comment out "UnitSelectionColor = GameTooltip_UnitColor" it will stop the error but as said in my first post it doesn't seem to matter what method you are using.

My nameplate addon hooks CompactUnitFrame_UpdateHealthColor with the following code.

Lua Code:
  1. hooksecurefunc("CompactUnitFrame_UpdateHealthColor", function(frame)
  2.     if ( not nPlates.FrameIsNameplate(frame) ) then return end
  3.  
  4.     if ( not UnitIsConnected(frame.unit) ) then
  5.         local r, g, b = 0.5, 0.5, 0.5
  6.     else
  7.         if ( frame.optionTable.healthBarColorOverride ) then
  8.             local healthBarColorOverride = frame.optionTable.healthBarColorOverride
  9.             r, g, b = healthBarColorOverride.r, healthBarColorOverride.g, healthBarColorOverride.b
  10.         else
  11.             local localizedClass, englishClass = UnitClass(frame.unit)
  12.             local classColor = RAID_CLASS_COLORS[englishClass]
  13.             if ( UnitIsPlayer(frame.unit) and classColor and frame.optionTable.useClassColors ) then
  14.                     r, g, b = classColor.r, classColor.g, classColor.b
  15.             elseif ( CompactUnitFrame_IsTapDenied(frame) ) then
  16.                 r, g, b = 0.1, 0.1, 0.1
  17.             elseif ( frame.optionTable.colorHealthBySelection ) then
  18.                 if ( frame.optionTable.considerSelectionInCombatAsHostile and CompactUnitFrame_IsOnThreatListWithPlayer(frame.displayedUnit) ) then
  19.                     if ( nPlatesDB.TankMode ) then
  20.                         local target = frame.displayedUnit.."target"
  21.                         local isTanking, threatStatus = UnitDetailedThreatSituation("player", frame.displayedUnit)
  22.                         if ( isTanking and threatStatus ) then
  23.                             if ( threatStatus >= 3 ) then
  24.                                 r, g, b = 0.0, 1.0, 0.0
  25.                             elseif ( threatStatus == 2 ) then
  26.                                 r, g, b = 1.0, 0.6, 0.2
  27.                             end
  28.                         elseif ( nPlates.UseOffTankColor(target) ) then
  29.                             r, g, b = nPlatesDB.OffTankColor.r, nPlatesDB.OffTankColor.g, nPlatesDB.OffTankColor.b
  30.                         else
  31.                             r, g, b = 1.0, 0.0, 0.0;
  32.                         end
  33.                     else
  34.                         r, g, b = 1.0, 0.0, 0.0;
  35.                     end
  36.                 else
  37.                     r, g, b = UnitSelectionColor(frame.unit, frame.optionTable.colorHealthWithExtendedColors)
  38.                 end
  39.             elseif ( UnitIsFriend("player", frame.unit) ) then
  40.                 r, g, b = 0.0, 1.0, 0.0
  41.             else
  42.                 r, g, b = 1.0, 0.0, 0.0
  43.             end
  44.         end
  45.     end
  46.  
  47.         -- Execute Range Coloring
  48.  
  49.     if ( nPlatesDB.ShowExecuteRange and nPlates.IsInExecuteRange(frame) ) then
  50.         r, g, b = nPlatesDB.ExecuteColor.r, nPlatesDB.ExecuteColor.g, nPlatesDB.ExecuteColor.b
  51.     end
  52.  
  53.     if ( r ~= frame.healthBar.r or g ~= frame.healthBar.g or b ~= frame.healthBar.b ) then
  54.         frame.healthBar:SetStatusBarColor(r, g, b)
  55.  
  56.         if ( frame.optionTable.colorHealthWithExtendedColors ) then
  57.             frame.selectionHighlight:SetVertexColor(r, g, b)
  58.         else
  59.             frame.selectionHighlight:SetVertexColor(1, 1, 1)
  60.         end
  61.  
  62.         frame.healthBar.r, frame.healthBar.g, frame.healthBar.b = r, g, b
  63.     end
  64.  
  65.         -- Healthbar Border Coloring
  66.  
  67.     if ( frame.healthBar.beautyBorder ) then
  68.         for i = 1, 8 do
  69.             if ( UnitIsUnit(frame.displayedUnit, "target") ) then
  70.                 frame.healthBar.beautyBorder[i]:SetVertexColor(r,g,b,1)
  71.             else
  72.                 frame.healthBar.beautyBorder[i]:SetVertexColor(unpack(borderColor))
  73.             end
  74.         end
  75.     end
  76. end)

If you comment out "frame.healthBar.r, frame.healthBar.g, frame.healthBar.b = r, g, b" from the code the error is gone but since that is the code that actually sets the color it doesn't work without it.
__________________
Thomas aka Urnn
 
10-12-16, 06:13 PM   #6
Ketho
A Molten Giant
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 847
I can confirm it can happen in combat with just this snippet
Lua Code:
  1. DefaultCompactNamePlateFriendlyFrameOptions.useClassColors = true

taintLog (apparently same as the error log)
Code:
Interface\FrameXML\CompactUnitFrame.lua:372 CompactUnitFrame_UpdateHealthColor()
An action was blocked in combat because of taint from Test - SetTargetClampingInsets()
    Interface\AddOns\Blizzard_NamePlates\Blizzard_NamePlates.lua:221 NamePlateDriverFrame:SetupClassNameplateBars()
    Interface\AddOns\Blizzard_NamePlates\Blizzard_NamePlates.lua:74 NamePlateDriverFrame:OnNamePlateAdded()
    Interface\AddOns\Blizzard_NamePlates\Blizzard_NamePlates.lua:38

No idea really what is happening now, with the 7.1 nameplate changes as explained by zork :s

Last edited by Ketho : 10-12-16 at 06:21 PM.
 
10-12-16, 07:17 PM   #7
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Also, you cannot do this:

Code:
frame.healthBar.r, frame.healthBar.g, frame.healthBar.b = r, g, b
If you do, then your (insecure) values get read into Blizzard (secure) code and introduce taint, which breaks All The Things.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
 
10-12-16, 07:22 PM   #8
thomasjohnshannon
A Theradrim Guardian
 
thomasjohnshannon's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 60
Originally Posted by Phanx View Post
Also, you cannot do this:

Code:
frame.healthBar.r, frame.healthBar.g, frame.healthBar.b = r, g, b
If you do, then your (insecure) values get read into Blizzard (secure) code and introduce taint, which breaks All The Things.
That is how the function is currently setup on live and I haven't have any issues with it.
__________________
Thomas aka Urnn
 
10-17-16, 12:26 AM   #9
thomasjohnshannon
A Theradrim Guardian
 
thomasjohnshannon's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 60
Using SetStatusBarColor seems to work now but the the rest still bugs out.
__________________
Thomas aka Urnn
 
10-17-16, 01:11 AM   #10
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,721
Well you could do your nameplates with oUF. Would solve your issues.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW) | TDMOG

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
 
10-25-16, 07:17 AM   #11
Tercioo
An Aku'mai Servant
 
Tercioo's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 37
I can confirm that changing nearly any member of a blizzard nameplate is triggering protected errors.
This small snipped does trigger issues already:

C_Timer.NewTicker (1, function()
NamePlate1.UnitFrame.healthBar.r = 0
end)

We could just use "NamePlate1.UnitFrame.healthBar:SetStatusBarColor (1, 0, 0)" but without changing the .r .g .b values the blizzard nameplate addon will "think" the color is the same and won't trigger color changes by it self due to that.
 
12-18-16, 06:47 PM   #12
Ketho
A Molten Giant
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 847
So does anyone know how to change the nameplate colors without tainting them (in combat)?

I still don't understand what changed in 7.1 for nameplates to get tainted, while it had worked fine previously

(update 2-13) http://www.wowinterface.com/forums/s...ad.php?t=55127

Last edited by Ketho : 02-13-17 at 11:51 AM.
 
12-21-16, 05:39 PM   #13
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,273
I don't think this issue is strictly related to coloring and nameplates. I use the default plates and i don't have any coloring addon, and i still get this taint occasionally. Which mean the taint itself spread to this values somehow after a while anyway.
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » [PTR,7.1] Nameplate Color Change causes lua error in combat.

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