Thread Tools Display Modes
10-19-20, 04:57 AM   #1
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
Solved: Call failed: RestrictedFrames.lua:82: Invalid frame handle

I thought I had posted this last night/early this morning but maybe I was so tired I forgot to click submit rofl. Any help towards a resolution is appreciated

Anyway .. to make a long story short ..

nUI keeps giving me this error when the actionbar needs to switch during combat. Three scenarios currently exist where this happens:

1. Druid Form changing
2. Rogue Stealthing
3. Jade Forest Mine Cart Ride

In all 3 instances the action bar needs to change back to page 1 while still in combat. I have narrowed it down to being a problem somewhere in nUI .. but not with the actual action bar changing as that same code is in a standalone addon and works perfectly. So the question is has someone come across this and identified the root cause in their own addons to help me identify where it might be in nUI. The only thing I can think of is that somewhere in its almost 14 year history nUI has retained some elements that were valid in the old days, had minimal effect over several years and now rears its ugly head a bit too often for me.

The error itself:
Lua Code:
  1. {
  2.             ["message"] = "Interface\\FrameXML\\RestrictedExecution.lua:431: Call failed: Interface\\FrameXML\\RestrictedFrames.lua:82: Invalid frame handle",
  3.             ["time"] = "2020/10/18 21:29:26",
  4.             ["locals"] = "InCombatSkipped",
  5.             ["stack"] = "[string \"=[C]\"]: ?\n[string \"@Interface\\FrameXML\\RestrictedExecution.lua\"]:431: in function <Interface\\FrameXML\\RestrictedExecution.lua:420>\n[string \"=(tail call)\"]: ?\n[string \"=(tail call)\"]: ?\n[string \"@Interface\\FrameXML\\SecureHandlers.lua\"]:115: in function <Interface\\FrameXML\\SecureHandlers.lua:110>\n[string \"=[C]\"]: in function `SetAttribute'\n[string \"@Interface\\FrameXML\\SecureStateDriver.lua\"]:114: in function <Interface\\FrameXML\\SecureStateDriver.lua:95>\n[string \"@Interface\\FrameXML\\SecureStateDriver.lua\"]:127: in function <Interface\\FrameXML\\SecureStateDriver.lua:119>",
  6.             ["session"] = 263,
  7.             ["counter"] = 39,
  8.         }, -- [4]


For completions sake this is my standalone code that works flawlessly which I aim to add to my nUI replacement somewhere down the line.

Main Menu Bar
Lua Code:
  1. local addon,data = ...
  2. data = data or {}
  3. data.BlizzUI = data.BlizzUI or CreateFrame("Frame")
  4. --MainMenuBarArtFrame:SetParent(data.BlizzUI)
  5. data.BlizzUI:Hide()
  6.  
  7. local BUTTON_SIZE, BUTTON_SPACING = 50, 1
  8.  
  9. ------------------------------------------------------
  10. --[[              Bar Setup                       ]]--
  11. ------------------------------------------------------
  12. local barFrame = CreateFrame("Frame", "XBar_Main", UIParent, "SecureHandlerStateTemplate")
  13. barFrame:SetSize((BUTTON_SIZE + BUTTON_SPACING) * NUM_ACTIONBAR_BUTTONS, BUTTON_SIZE)
  14. barFrame:SetPoint("CENTER")
  15.  
  16. local background = barFrame:CreateTexture(nil, "BACKGROUND")
  17. background:SetColorTexture(0, 0, 0, 0.5)
  18. background:SetAllPoints()
  19.  
  20. barFrame:Execute([[
  21.     ActionButtons = newtable()
  22. ]])
  23.  
  24. ------------------------------------------------------
  25. --[[                 Button Setup                 ]]--
  26. ------------------------------------------------------
  27. local buttons = { }
  28. for id = 1, NUM_ACTIONBAR_BUTTONS do
  29.     local button = CreateFrame("CheckButton", "$parent_Button" .. id, barFrame, "ActionBarButtonTemplate")
  30.     button:SetID(id)
  31.     button:SetSize(BUTTON_SIZE, BUTTON_SIZE)
  32.    
  33.     if id ~= 1 then
  34.         button:SetPoint("LEFT", buttons[id - 1], "RIGHT", BUTTON_SPACING, 0)
  35.     else
  36.         button:SetPoint("LEFT", 5, 0)
  37.     end
  38.  
  39.     local background = button:CreateTexture(nil, "BACKGROUND")
  40.     background:SetColorTexture(1, 1, 1, 0.5)
  41.     background:SetAllPoints()
  42.  
  43.     button.NormalTexture:Hide()
  44.  
  45.     barFrame:SetFrameRef("button", button)
  46.     barFrame:Execute(([[
  47.         ActionButtons[%s] = self:GetFrameRef("button")
  48.     ]]):format(id))
  49.  
  50.     buttons[id] = button
  51. end
  52. barFrame.Buttons = buttons
  53.  
  54. ------------------------------------------------------
  55. --[[                 Secure Stuff                 ]]--
  56. ------------------------------------------------------
  57. barFrame:Execute([[
  58.     self:SetAttribute("frameref-button", nil)
  59. ]])
  60.  
  61. barFrame:SetAttribute('_onstate-page', ([[
  62.     if not newstate then return end
  63.     newstate = tonumber(newstate)
  64.        
  65. if HasVehicleActionBar() then
  66.    -- print("Vehicle")
  67.     newPage = GetVehicleBarIndex() or 0
  68. elseif HasOverrideActionBar() then
  69.     --print("Override")
  70.     newPage = GetOverrideBarIndex() or 0
  71. elseif HasTempShapeshiftActionBar() then
  72.     --print("Shapeshift")
  73.     newPage = GetTempShapeshiftBarIndex() or 0
  74. elseif HasBonusActionBar() and GetActionBarPage() == 1 then
  75.     --print("BonusBar")
  76.     newPage = GetBonusBarIndex() or 0
  77.        
  78. else
  79.     --print("Other")
  80.     newPage = 0
  81. end
  82.            
  83.     --print("NewPage: ",newPage)
  84.     --print("newstate: ",newstate)
  85.        
  86.     if ( newPage == 0 ) then
  87.         newstate = GetActionBarPage()
  88.     end
  89.        
  90.     self:SetAttribute("actionpage", newstate)
  91.  
  92.     for id = 1, #ActionButtons do
  93.         ActionButtons[id]:SetAttribute('actionpage', newstate)
  94.     end
  95.  
  96. ]]):gsub('NUM_ACTIONBAR_BUTTONS', NUM_ACTIONBAR_BUTTONS))
  97.  
  98.  
  99.  
  100. ------------------------------------------------------
  101. --[[           Registration Stuff                 ]]--
  102. ------------------------------------------------------
  103. RegisterStateDriver(
  104.     barFrame, "page", string.format(
  105.         "[vehicleui][possessbar] %d; [vehicleui] %d; [overridebar] %d; [shapeshift] %d; " ..
  106.         "[bar:2] 2; [bar:3] 3; [bar:4] 4; [bar:5] 5; [bar:6] 6; " ..
  107.         "[bonusbar:1] 7; [bonusbar:2] 8; [bonusbar:3] 9; [bonusbar:4] 10; [bonusbar:5] 11; 1",
  108.         GetVehicleBarIndex(), GetVehicleBarIndex(), GetOverrideBarIndex(), GetTempShapeshiftBarIndex())
  109. );
  110.  
  111. OverrideActionBarLeaveFrameLeaveButton:SetParent(barFrame)
  112. OverrideActionBarLeaveFrameLeaveButton:SetAllPoints(buttons[12])
  113. RegisterStateDriver(OverrideActionBarLeaveFrameLeaveButton, "visibility", "[canexitvehicle] show; hide")
  114.  
  115. local function OnEvent(self,event,...)
  116.     if event == "UPDATE_VEHICLE_ACTIONBAR" then
  117.         barFrame:Execute(([[   self:SetAttribute('state-page',GetVehicleBarIndex())  ]]))
  118.     elseif event == "UPDATE_OVERRIDE_ACTIONBAR" then
  119.         barFrame:Execute(([[   self:SetAttribute('state-page',GetOverrideBarIndex())  ]]))        
  120.     end
  121. end
  122.  
  123. barFrame:RegisterEvent("UPDATE_VEHICLE_ACTIONBAR")
  124. barFrame:RegisterEvent("UPDATE_OVERRIDE_ACTIONBAR")
  125. barFrame:SetScript("OnEvent",OnEvent)

Stance Bar
Lua Code:
  1. local addon,data = ...
  2. data = data or {}
  3. data.BlizzUI = data.BlizzUI or CreateFrame("Frame")
  4. --StanceBarFrame:SetParent(data.BlizzUI)
  5. data.BlizzUI:Hide()
  6.  
  7. local BUTTON_SIZE, BUTTON_SPACING = 50, 1
  8.  
  9. ------------------------------------------------------
  10. --[[              Bar Setup                       ]]--
  11. ------------------------------------------------------
  12. local barFrame = CreateFrame("Frame", "XBar_Stance", UIParent, "SecureFrameTemplate")
  13. barFrame:SetSize((BUTTON_SIZE + BUTTON_SPACING) * NUM_STANCE_SLOTS, BUTTON_SIZE)
  14. barFrame:SetPoint("BOTTOMLEFT", XBar_Main, "TOPLEFT",0,0)
  15.  
  16. local background = barFrame:CreateTexture(nil, "BACKGROUND")
  17. background:SetColorTexture(0, 0, 0, 0.5)
  18. background:SetAllPoints()
  19.  
  20. ------------------------------------------------------
  21. --[[                 Button Setup                 ]]--
  22. ------------------------------------------------------
  23. local buttons = { }
  24. for id = 1, NUM_STANCE_SLOTS do
  25.     local button = CreateFrame("CheckButton", "$parent_Button" .. id, barFrame, "StanceButtonTemplate")
  26.     button.actionType = "SHAPESHIFTBUTTON";
  27.     button:SetID(id)
  28.     button:SetNormalTexture( "" );
  29.     button:SetSize(BUTTON_SIZE, BUTTON_SIZE)
  30.    
  31.     if id ~= 1 then
  32.         button:SetPoint("LEFT", buttons[id - 1], "RIGHT", BUTTON_SPACING, 0)
  33.     else
  34.         button:SetPoint("LEFT", 5, 0)
  35.     end
  36.  
  37.     local background = button:CreateTexture(nil, "BACKGROUND")
  38.     background:SetColorTexture(1, 1, 1, 0.5)
  39.     background:SetAllPoints()
  40.  
  41.     -- Set Cooldown
  42.     local start, duration, enable = GetShapeshiftFormCooldown(id);
  43.     CooldownFrame_Set(button.cooldown, start, duration, enable);
  44.  
  45.     -- Set Icon
  46.     local texture, name, isActive, isCastable = GetShapeshiftFormInfo( id );
  47.     button.icon:SetTexture(texture);
  48.    
  49.     -- Set Check Status
  50.     if ( isActive ) then
  51.         button:SetChecked(true);
  52.     else
  53.         button:SetChecked(false);
  54.     end
  55.    
  56.     -- Set Cast Status
  57.     if ( isCastable ) then
  58.         button.icon:SetVertexColor(1.0, 1.0, 1.0);
  59.     else
  60.         button.icon:SetVertexColor(0.4, 0.4, 0.4);
  61.     end
  62.    
  63.     button.NormalTexture:Hide()
  64.  
  65.     buttons[id] = button
  66. end
  67. barFrame.Buttons = buttons
  68.  
  69.  
  70. function barFrame:UpdateButtons()
  71.     for i = 0, 10 do
  72.         local button = barFrame.Buttons[i] or nil
  73.         if button then
  74.            
  75.             -- Set Icon
  76.             local texture, name, isActive, isCastable = GetShapeshiftFormInfo( i );
  77.             button.icon:SetTexture(texture);
  78.  
  79.             -- Set Check Status
  80.             if ( isActive ) then
  81.                 button:SetChecked(true);
  82.             else
  83.                 button:SetChecked(false);
  84.             end
  85.            
  86.             -- Set Cooldown
  87.             local start, duration, enable = GetShapeshiftFormCooldown(i);
  88.             CooldownFrame_Set(button.cooldown, start, duration, enable);
  89.             button.cooldown:SetDrawSwipe()
  90.             button.cooldown:Show()            
  91.         end
  92.     end    
  93. end
  94.  
  95.  
  96. ------------------------------------------------------
  97. --[[           Registration Stuff                 ]]--
  98. ------------------------------------------------------
  99. RegisterStateDriver( barFrame, "visibility", "[bonusbar:5] hide; show" );
  100.  
  101.  
  102. local function OnEvent(self,event,...)
  103.     --print(event,...)
  104.  
  105.     if event == "UPDATE_SHAPESHIFT_FORM" or
  106.        event ==  "UPDATE_SHAPESHIFT_FORMS" or
  107.        event ==  "UPDATE_SHAPESHIFT_COOLDOWN" or
  108.        event ==  "UPDATE_SHAPESHIFT_USABLE"  then
  109.         if InCombatLockdown() then
  110.             barFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
  111.         else
  112.             barFrame:UpdateButtons()
  113.         end
  114.     elseif event == "PLAYER_REGEN_ENABLED" then
  115.         self:UnregisterEvent(event)
  116.         barFrame:UpdateButtons()
  117.     end
  118. end
  119.  
  120. barFrame:RegisterEvent("UPDATE_SHAPESHIFT_COOLDOWN")
  121. barFrame:RegisterEvent("UPDATE_SHAPESHIFT_FORM")
  122. barFrame:RegisterEvent("UPDATE_SHAPESHIFT_FORMS")
  123. barFrame:RegisterEvent("UPDATE_SHAPESHIFT_USABLE")
  124. barFrame:SetScript("OnEvent",OnEvent)
__________________

Last edited by Xrystal : 10-22-20 at 07:18 AM. Reason: Title change
  Reply With Quote
10-22-20, 07:17 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
Solved: Call failed: RestrictedFrames.lua:82: Invalid frame handle

After going through my mini addon and comparing sections of code between the code I notices some excess and misplaced secure code. Once I rearranged and adjusted them the issue goes away.
__________________
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Help: Call failed: RestrictedFrames.lua:82: Invalid frame handle

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off