Stanzilla / WoWUIBugs

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

GetPoint() returns nil values in combat from secure snippets. #480

Closed Verubato closed 9 months ago

Verubato commented 9 months ago

Calling GetPoint() on a protected frame during combat from a secure handler snippet returns nil values, while performing the same GetPoint() call from insecure code returns the correct values.

Example to reproduce the issue:

local secureFrame = CreateFrame("Frame", nil, nil, "SecureHandlerStateTemplate")
secureFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
secureFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
secureFrame:HookScript("OnEvent", function()
    SecureHandlerSetFrameRef(secureFrame, "frame-test", CompactPartyFrameMember1)
end)

RegisterAttributeDriver(secureFrame, "state-target", "[@target, exists] true; false")

SecureHandlerWrapScript(
    secureFrame,
    "OnAttributeChanged",
    secureFrame,
    [[
    if name ~= "state-target" then return end

    local frame = self:GetFrameRef("frame-test")
    local inCombat = SecureCmdOptionParse("[combat] true; false") == "true"

    if not frame then return end

    local point, relativeTo, relativePoint, offsetX, offsetY = frame:GetPoint()
    print(
        "Combat: ",
        inCombat,
        "Frame: ",
        frame:GetName(),
        point,
        relativeTo and relativeTo:GetName(),
        relativePoint,
        offsetX,
        offsetY)
]]
)

image

Not sure if this is expected behaviour but it certainly doesn't seem right.

Nevcairiel commented 9 months ago

This seems likely to be a side-effect of #470, since CompactPartyFrame (the anchor frame) is not explicitly protected, and therefor the result is suppressed.

Meorawr commented 9 months ago

I'll mark this as a duplicate and close it pending resolution of #470 - if however it turns out that we're wrong and these are unrelated I'll re-open this issue.