This is not a help request, but just friendly info for devs who make the same mistake as me. If this is the wrong place to post it, then feel free to move it somewhere else
I had a very weird taint problem today when clicking on a glyph (in the glyph talent pane).
I did a
/console taintLog 2
to try and find the troublemaker bug in my code. But the taint log claimed the bug was some weird place in my code, and that my code was violating Blizzard_GlyphUI. I then tried to out-comment a lot of code and then it finally claimed that the cause was at line 1 in one of my Lua files.... O_o
The troublemaker line was:
_, SimpleHUD["player"].class = UnitClass("player")
and the troublemaker itself was the trash var: _
In the end I solved the problem by changing the line to:
_TRASHVAR_, SimpleHUD["player"].class = UnitClass("player")
_TRASHVAR_=nil
I hope this might help someone else who has the same problem. I've never had problems with the same line of code until today, so it must be some new change with latest patch.
The troublemaker line was:
_, SimpleHUD["player"].class = UnitClass("player")
and the troublemaker itself was the trash var: _
In the end I solved the problem by changing the line to:
_TRASHVAR_, SimpleHUD["player"].class = UnitClass("player")
_TRASHVAR_=nil
Your solution is still not quite correct.
The problem is that your original code was creating a global variable named _. This is generally referred to as leaking a global -- because the variable was not intentionally added to the global namespace, and has no reason to be there -- and should be avoided at all costs.
It caused taint issues because Blizzard is making the same mistake, and leaking a global _ variable.
Your new code just changes the name from _ to _TRASHVAR_, but it's still leaking a global. You're just not seeing a breaking issue because Blizzard isn't leaking any globals with the same name.
See Torhal's post for the correct ways to solve the problem.
I had a very weird taint problem today when clicking on a glyph (in the glyph talent pane).
I did a
/console taintLog 2
to try and find the troublemaker bug in my code. But the taint log claimed the bug was some weird place in my code, and that my code was violating Blizzard_GlyphUI. I then tried to out-comment a lot of code and then it finally claimed that the cause was at line 1 in one of my Lua files.... O_o
The troublemaker line was:
_, SimpleHUD["player"].class = UnitClass("player")
and the troublemaker itself was the trash var: _
In the end I solved the problem by changing the line to:
_TRASHVAR_, SimpleHUD["player"].class = UnitClass("player")
_TRASHVAR_=nil
I hope this might help someone else who has the same problem. I've never had problems with the same line of code until today, so it must be some new change with latest patch.
or even
Your solution is still not quite correct.
The problem is that your original code was creating a global variable named _. This is generally referred to as leaking a global -- because the variable was not intentionally added to the global namespace, and has no reason to be there -- and should be avoided at all costs.
It caused taint issues because Blizzard is making the same mistake, and leaking a global _ variable.
Your new code just changes the name from _ to _TRASHVAR_, but it's still leaking a global. You're just not seeing a breaking issue because Blizzard isn't leaking any globals with the same name.
See Torhal's post for the correct ways to solve the problem.
Nice to know I'm not the only one who is uninformed :P.
Thanks for your inputs guys. Never thought much about leaking globals, because I normally have a habit of stuffing everything into a table.