Stanzilla / WoWUIBugs

World of Warcraft UI Bug Tracker
166 stars 7 forks source link

Invalid frame handle in RestrictedFrames #469

Closed sfmict closed 1 year ago

sfmict commented 1 year ago

This error only occurs in combat in 3.4.3 and 10.1.7

1x FrameXML/RestrictedExecution.lua:431: Call failed: FrameXML/RestrictedFrames.lua:83: Invalid frame handle
[string "=[C]"]: ?
[string "@FrameXML/RestrictedExecution.lua"]:431: in function <FrameXML/RestrictedExecution.lua:420>
[string "=(tail call)"]: ?
[string "=(tail call)"]: ?
[string "@FrameXML/SecureHandlers.lua"]:91: in function `SecureHandler_OnClick'
[string "*SecureHandlerTemplates.xml:43_OnClick"]:1: in function <[string "*SecureHandlerTemplates.xml:43_OnClick"]:1>

Locals:
(*temporary) = "Call failed: FrameXML/RestrictedFrames.lua:83: Invalid frame handle"

Сode to check

local f = CreateFrame("BUTTON", nil, UIParent, "UIPanelButtonTemplate,SecureHandlerClickTemplate")
f:SetSize(128, 22)
f:ClearAllPoints()
f:SetPoint("TOPLEFT", (UIParent:GetWidth() - f:GetWidth()) / 2, (f:GetHeight() - UIParent:GetHeight()) / 2)

local f2 = CreateFrame("BUTTON", nil, UIParent, "UIPanelButtonTemplate")
f2:SetPoint("TOP", f, "BOTTOM")

f:SetFrameRef("f2", f2)
f:SetAttribute("_onclick", [[
    local f2 = self:GetFrameRef("f2")
    if  f2:IsShown() then
        f2:Hide()
    else
        f2:Show()
    end
]])
Meorawr commented 1 year ago

As far as I understand the RE code; this isn't a bug. You're not supposed to be able to call certain methods on unprotected frames from within the restricted environment - this includes IsShown, Hide, and Show.

sfmict commented 1 year ago

The same error

local f = CreateFrame("BUTTON", nil, UIParent, "UIPanelButtonTemplate,SecureHandlerClickTemplate")
f:SetSize(128, 22)
f:ClearAllPoints()
f:SetPoint("TOPLEFT", (UIParent:GetWidth() - f:GetWidth()) / 2, (f:GetHeight() - UIParent:GetHeight()) / 2)

local f2 = CreateFrame("BUTTON", nil, UIParent, "UIPanelButtonTemplate")
f2:SetSize(128, 22)
f2:SetPoint("TOP", f, "BOTTOM")
f:SetFrameRef("f2", f2)
f:SetAttribute("_onclick", [[
    local f2 = self:GetFrameRef("f2")
    f2:CallMethod("Click")
]])
Nevcairiel commented 1 year ago

In combat, only protected frames can be used as frame handles in general, no matter what you try to do with them. This is not a new requirement, and not likely to go away. But since these are insecure frames, you can just CallMethod a function on your secure frame, and hand-off any insecure processing tothat.

sfmict commented 1 year ago

hmm, if that's the case, thx for the reply, sorry to disturb, closed.