Hey,
I think my addon is causing a C Stack Overflow.
I think it's creating more frame each time the function is called but I don't really understand hoow it works.
My function is
Lua Code:
function poseDot()
local iter = 0
hooksecurefunc("ContainerFrame_Update",function(self)
local bag = self:GetID() -- container's ID is the bag number
--print("aze : "..bag)
iter = iter + 1
for i=1,self.size do
local button=_G[self:GetName().."Item"..i]
local slot = button:GetID() -- button's ID is slot number
local itemLink = GetContainerItemLink(bag, slot)
if itemLink ~= nil then
if button.overlay then
button.overlay:SetShown(false)
button.overlay = nil
--button=_G[self:GetName().."Item"..i]
end
--print(itemLink)
local weightCalcResult = weightCalculation(itemLink)
if weightCalcResult[1] ~= nil and weightCalcResult[1] > 0 or weightCalcResult[2] ~= nil and weightCalcResult[2] > 0 then
--local itemId = tonumber(parseID(itemLink))
-- create overlay texture if it doesn't exit for the button
if not button.overlay then
button.overlay = button:CreateTexture(nil,"OVERLAY")
button.overlay:SetSize(18,18)
button.overlay:SetPoint("TOPLEFT")
button.overlay:SetTexture("Interface\\AddOns\\GearHelper\\Textures\\flecheUp")
--button.overlay:SetTexture("Interface\\Common\\Indicator-Green")
button.overlay:SetShown(true)
end
end
weightCalcResult = nil
end
button = nil
slot = nil
itemLink = nil
end
bag = nil
self = nil
end)
end
It's called every time I open my bag.
I'll edit this post, to show you error when it apear.
Issue :
Lua Code:
232x C stack overflow
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: ?
[C]: ?
...
[string "*:OnShow"]:1: in function <[string "*:OnShow"]:1>
[C]: in function `Show'
FrameXML\ContainerFrame.lua:843: in function `ContainerFrame_GenerateFrame'
FrameXML\ContainerFrame.lua:93: in function <FrameXML\ContainerFrame.lua:77>
[C]: in function `ToggleBag'
FrameXML\ContainerFrame.lua:115: in function `ToggleBackpack'
FrameXML\ContainerFrame.lua:330: in function `OpenBackpack'
FrameXML\ContainerFrame.lua:1276: in function <FrameXML\ContainerFrame.lua:1253>
[C]: in function `ToggleAllBags'
[string "OPENALLBAGS"]:1: in function <[string "OPENALLBAGS"]:1>
Locals:
(*temporary) = ContainerFrame1 {
0 = <userdata>
PortraitButton = ContainerFrame1PortraitButton {
}
Portrait = ContainerFrame1Portrait {
}
ClickableTitleFrame = <unnamed> {
}
bags = <table> {
}
FilterDropDown = ContainerFrame1FilterDropDown {
}
bagsShown = 1
FilterIcon = <unnamed> {
}
allBags = true
size = 16
}
(*temporary) = <function> defined =[C]:-1
(*temporary) = ContainerFrame1 {
0 = <userdata>
PortraitButton = ContainerFrame1PortraitButton {
}
Portrait = ContainerFrame1Portrait {
}
ClickableTitleFrame = <unnamed> {
}
bags = <table> {
}
FilterDropDown = ContainerFrame1FilterDropDown {
}
bagsShown = 1
FilterIcon = <unnamed> {
}
allBags = true
size = 16
}
= <function> defined =[C]:-1
= <function> defined @GearHelper\GearHelper.lua:540
Thanks