I'm working on a simple addon that puts a little hotbar under your personal resource display so you can easily track your procs and cooldowns of the common abilities. I'm frequently getting the following error in bugsack, occurring when the personal resource display appears and the addon ties to attach its frame to it. It seems to mostly occur when there's some kind of state change like just landing from a ferry, a targeted NPC turning hostile which forces the bar to appear, etc.
[ADDON_ACTION_BLOCKED] AddOn 'Handybar' tried to call the protected function 'Handybar_Frame:SetPoint()'.
So,what my addon is doing is creating an event frame and main frame for the addon as such:
Lua Code:
local eventFrame = CreateFrame("frame", "eventFrameHB")
eventFrame:RegisterEvent("NAME_PLATE_UNIT_ADDED")
eventFrame:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
eventFrame:RegisterEvent("ADDON_LOADED")
local HBFrame = CreateFrame("frame", "Handybar_Frame", UIParent)
Then, in InitializeHB() (which is called from the event handler a few blocks down) I'm creating the ability icon frames and aligning them up on the main frame, with iconList just being a list of action bar slot IDs I'm hardcoding per character in my script for the time being:
Lua Code:
for i, v in ipairs(iconList) do
local newFrame = CreateFrame("CHECKBUTTON", "Handybar_ButtonFrame"..tostring(i), HBFrame, "SecureActionButtonTemplate, ActionBarButtonTemplate")
newFrame:SetPoint("LEFT", HBFrame, "CENTER", (i-1) * 48 - calculatedXOffset, 0)
newFrame:SetAttribute("type", "action")
newFrame:SetAttribute("action", v)
newFrame:SetScale(0.5)
newFrame:EnableMouse(false)
end
Now here's my event handler. The SetPoint() on Line 7 here seems to be where the error is getting thrown.
Lua Code:
eventFrame:SetScript("OnEvent", function(self, event, ...)
if event == "NAME_PLATE_UNIT_ADDED" then
if handybarVariables.attachToPRD then
if UnitIsUnit (..., "player") then
HBFrame:ClearAllPoints()
HBFrame:SetParent(C_NamePlate.GetNamePlateForUnit("player"))
HBFrame:SetPoint("CENTER", C_NamePlate.GetNamePlateForUnit("player"), "CENTER", 0, yOffsetDefault)
HBFrame:Show()
end
end
elseif event == "NAME_PLATE_UNIT_REMOVED" then
if handybarVariables.attachToPRD then
if UnitIsUnit (..., "player") then
HBFrame:ClearAllPoints();
HBFrame:Hide()
HBFrame:SetParent(UIParent)
end
end
elseif event == "ADDON_LOADED" then
InitializeHB()
self:UnregisterEvent("ADDON_LOADED")
end
end)
This code is largely copied from Weakauras' PRD attaching code, however it's possible that I didn't quite catch something. Is there anything obvious I'm doing wrong here? If it would be helpful I can pastebin the entire lua file or something as well.
This has been my dream addon for a long time and I'm working on hard on getting it stable enough to share. I did as much research as I could, but all the google results for this error are just talking about sending it to the addon devs and I couldn't find anything about it from the dev perspective.