Quantcast
WoWInterface - View Single Post - C Stack Overflow
View Single Post
11-21-17, 12:57 PM   #1
Marsgames
An Aku'mai Servant
 
Marsgames's Avatar
Join Date: Jul 2016
Posts: 33
C Stack Overflow

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:
  1. function poseDot()
  2.  local iter = 0
  3.     hooksecurefunc("ContainerFrame_Update",function(self)
  4.             local bag = self:GetID() -- container's ID is the bag number
  5.             --print("aze : "..bag)
  6.             iter = iter + 1
  7.             for i=1,self.size do
  8.                 local button=_G[self:GetName().."Item"..i]
  9.                 local slot = button:GetID() -- button's ID is slot number
  10.                 local itemLink = GetContainerItemLink(bag, slot)
  11.  
  12.                 if itemLink ~= nil then
  13.                     if button.overlay then
  14.                         button.overlay:SetShown(false)
  15.                         button.overlay = nil
  16.                         --button=_G[self:GetName().."Item"..i]
  17.                     end
  18.                     --print(itemLink)
  19.                     local weightCalcResult = weightCalculation(itemLink)
  20.                     if weightCalcResult[1] ~= nil and weightCalcResult[1] > 0 or weightCalcResult[2] ~= nil and weightCalcResult[2] > 0 then
  21.                         --local itemId = tonumber(parseID(itemLink))
  22.  
  23.                         -- create overlay texture if it doesn't exit for the button
  24.                         if not button.overlay then
  25.                             button.overlay = button:CreateTexture(nil,"OVERLAY")
  26.                             button.overlay:SetSize(18,18)
  27.                             button.overlay:SetPoint("TOPLEFT")
  28.                             button.overlay:SetTexture("Interface\\AddOns\\GearHelper\\Textures\\flecheUp")
  29.                             --button.overlay:SetTexture("Interface\\Common\\Indicator-Green")
  30.                             button.overlay:SetShown(true)
  31.                         end
  32.                     end
  33.                     weightCalcResult = nil
  34.                 end
  35.                 button = nil
  36.                 slot = nil
  37.                 itemLink = nil
  38.             end
  39.             bag = nil
  40.             self = nil
  41.  
  42.     end)
  43. 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:
  1. 232x C stack overflow
  2. [C]: ?
  3. [C]: ?
  4. [C]: ?
  5. [C]: ?
  6. [C]: ?
  7. [C]: ?
  8. [C]: ?
  9. [C]: ?
  10. [C]: ?
  11. [C]: ?
  12. [C]: ?
  13. [C]: ?
  14. ...
  15. [string "*:OnShow"]:1: in function <[string "*:OnShow"]:1>
  16. [C]: in function `Show'
  17. FrameXML\ContainerFrame.lua:843: in function `ContainerFrame_GenerateFrame'
  18. FrameXML\ContainerFrame.lua:93: in function <FrameXML\ContainerFrame.lua:77>
  19. [C]: in function `ToggleBag'
  20. FrameXML\ContainerFrame.lua:115: in function `ToggleBackpack'
  21. FrameXML\ContainerFrame.lua:330: in function `OpenBackpack'
  22. FrameXML\ContainerFrame.lua:1276: in function <FrameXML\ContainerFrame.lua:1253>
  23. [C]: in function `ToggleAllBags'
  24. [string "OPENALLBAGS"]:1: in function <[string "OPENALLBAGS"]:1>
  25.  
  26. Locals:
  27. (*temporary) = ContainerFrame1 {
  28.  0 = <userdata>
  29.  PortraitButton = ContainerFrame1PortraitButton {
  30.  }
  31.  Portrait = ContainerFrame1Portrait {
  32.  }
  33.  ClickableTitleFrame = <unnamed> {
  34.  }
  35.  bags = <table> {
  36.  }
  37.  FilterDropDown = ContainerFrame1FilterDropDown {
  38.  }
  39.  bagsShown = 1
  40.  FilterIcon = <unnamed> {
  41.  }
  42.  allBags = true
  43.  size = 16
  44. }
  45. (*temporary) = <function> defined =[C]:-1
  46. (*temporary) = ContainerFrame1 {
  47.  0 = <userdata>
  48.  PortraitButton = ContainerFrame1PortraitButton {
  49.  }
  50.  Portrait = ContainerFrame1Portrait {
  51.  }
  52.  ClickableTitleFrame = <unnamed> {
  53.  }
  54.  bags = <table> {
  55.  }
  56.  FilterDropDown = ContainerFrame1FilterDropDown {
  57.  }
  58.  bagsShown = 1
  59.  FilterIcon = <unnamed> {
  60.  }
  61.  allBags = true
  62.  size = 16
  63. }
  64.  = <function> defined =[C]:-1
  65.  = <function> defined @GearHelper\GearHelper.lua:540







Thanks

Last edited by Marsgames : 11-21-17 at 01:11 PM.
  Reply With Quote