Thread Tools Display Modes
Prev Previous Post   Next Post Next
10-07-14, 11:09 AM   #1
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Is this a bug in secure frames SetFrameRef/GetFrameRef?

I've found some strange behavior within the Set/GetFrameRef() thing for secure frames.

Consider the following code:

Lua Code:
  1. local header = CreateFrame("Frame", "testheader", UIParent, "SecureHandlerStateTemplate")
  2. header:SetFrameRef("ActionButton1", _G["ActionButton1"])
  3.  
  4. local button = CreateFrame("CheckButton", "testbutton1", header, "SecureActionButtonTemplate, ActionButtonTemplate")
  5. button:SetPoint("CENTER", UIParent, "CENTER")
  6.    
  7. header:WrapScript(button, "OnClick", [[
  8.     print("ActionButton1.IsForbidden =", self:GetParent():GetFrameRef("ActionButton1").IsForbidden)
  9. ]])
  10.  
  11. print("ActionButton1.IsForbidden =", _G["ActionButton1"].IsForbidden, _G["ActionButton1"]:IsForbidden())

It prints:
ActionButton1.IsForbidden = function: <.....> false
Now click the test button.

It prints:
ActionButton1.IsForbidden = nil
Ehm?

Try again:
Lua Code:
  1. print("ActionButton1.IsForbidden =", _G["ActionButton1"].IsForbidden, _G["ActionButton1"]:IsForbidden())

Result:
ActionButton1.IsForbidden = function: <.....> false
WTF??

So, is it me, or is GetFrameRef() returning something that is not equal to the original object that was passed to SetFrameRef()?
Could someone please verify if this is a bug or if I'm just stupid?

Last edited by Duugu : 10-07-14 at 11:14 AM.
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » Is this a bug in secure frames SetFrameRef/GetFrameRef?


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