Butter Quest Tracker

Butter Quest Tracker

97.1k Downloads

Error after checking my spellbook while fighting a monster

Nillx opened this issue ยท 3 comments

commented

I feel like an error magnet at this point :D Got this error after checking which spells im missing. Using this addon: https://www.wowinterface.com/downloads/info25031-WhatsTraining.html

1x [ADDON_ACTION_BLOCKED] AddOn 'ButterQuestTracker' tried to call the protected function 'SpellButton2:Show()'.
!BugGrabber\BugGrabber.lua:519: in function <!BugGrabber\BugGrabber.lua:519>
[C]: in function `Show'
FrameXML\SpellBookFrame.lua:185: in function `SpellBookFrame_UpdateSpells'
FrameXML\SpellBookFrame.lua:769: in function `SpellBook_UpdatePlayerTab'
FrameXML\SpellBookFrame.lua:14: in function `tabUpdate'
FrameXML\SpellBookFrame.lua:160: in function <FrameXML\SpellBookFrame.lua:112>
[C]: in function `SpellBookFrame_Update'
FrameXML\SpellBookFrame.lua:97: in function <FrameXML\SpellBookFrame.lua:96>
[C]: in function `Show'
FrameXML\UIParent.lua:2078: in function `SetUIPanel'
FrameXML\UIParent.lua:1923: in function `ShowUIPanel'
FrameXML\UIParent.lua:1784: in function <FrameXML\UIParent.lua:1780>
[C]: in function `SetAttribute'
FrameXML\UIParent.lua:2526: in function `ShowUIPanel'
FrameXML\SpellBookFrame.lua:46: in function `ToggleSpellBook'
[string "TOGGLESPELLBOOK"]:1: in function <[string "TOGGLESPELLBOOK"]:1>

Locals:
InCombatSkipped

Got this one after checking the default blizzard spellbook

1x [ADDON_ACTION_BLOCKED] AddOn 'ButterQuestTracker' tried to call the protected function 'SpellButton2:Enable()'.
!BugGrabber\BugGrabber.lua:519: in function <!BugGrabber\BugGrabber.lua:519>
[C]: in function `Enable'
FrameXML\SpellBookFrame.lua:493: in function `SpellButton_UpdateButton'
FrameXML\SpellBookFrame.lua:271: in function `SpellButton_OnEvent'
[string "*:OnEvent"]:1: in function <[string "*:OnEvent"]:1>

Locals:
InCombatSkipped
commented

Well that's certainly different!

Looking into it now. Haha

commented

So I literally just spent the past hour debugging this and I'm going to attempt to explain what the issue was in an attempt to retain my sanity.

However first I thought I'd let you know that this issue should be resolved in 1.9.0-rc.4.

Now onto the ramblings of a mad man!

Basically the specific line of code causing the problem was here...

self.color = self:_normalizeColor(color);

More specifically the issue was with the default values I was passing up here...

self:SetColor(NORMAL_FONT_COLOR);
self:SetHoverColor(HIGHLIGHT_FONT_COLOR);

These values contain rgb values, but they also contain a whole bunch of functions.
I'm guessing it had something to do with how WoWs UIFrameCache reuses frames in conjunction with this fact that was causing the problem.

After digging into it further I'm convinced it's because of the rgb assignments (value.r = value.r or 0.0) I had in that function. Basically I was updating the globally shared color variables Blizzard provides NORMAL_FONT_COLOR and HIGHLIGHT_FONT_COLOR.

When the spellbook tried to access these modified variables it ended up causing problems.

Upon updating the output of _normalizeColor..

function Base:_normalizeColor(value)
if type(value) == "string" then
value = self:_hex2rgb(value);
elseif type(value) == "table" then
value.r = value.r or 0.0;
value.g = value.g or 0.0;
value.b = value.b or 0.0;
value.a = value.a or 1.0;
end
return value;
end

To instead only return the rgba values...

function Base:_normalizeColor(value)
if not value then return end
if type(value) == "string" then
value = self:_hex2rgb(value);
end
return {
r = value.r or 0.0,
g = value.g or 0.0,
b = value.b or 0.0,
a = value.a or 1.0,
};
end

The issue magically went away.
The issue went away because we're returning a new object / table.

Now you may be asking yourself, how in the world did you figure that out?
Simply by commenting out segments of the code and narrowing down where the issue was.

commented

Pretty weirdly sounding bug! Wish i was able to provide some help but sadly my coding skills are extremely basic.

Ill install rc4 and ill let you know if i find more issues.