#0 - Nov. 23, 2006, 1:06 a.m.
I have created a test addon to demonstrate the problem. The addon will create a frame and display a button on it. When you click the button it displays the return values from frame:GetPoint().
After reloading the UI, the addon displays the frame:GetPoint() return values correctly. If you click on the button without moving the frame, the return values are again displayed correctly.
The problem starts when you drag the window. If you click the button after you have stopped dragging the window, the second return value from frame:GetPoint() may not be correct. I have seen it be nil or a table value. When it is a table value, it will sometimes crash the game if you attempt to call the GetName() method for it.
On the live server I sometimes get a nil value, and sometimes the game crashes with a fatal exception error. On the beta server, I always get the nil value while in the game, and sometimes when I logout I get the fatal exception error.
These problems occurred while no other addons were enabled.
-----
This application has encountered a critical error:
ERROR #132 (0x85100084) Fatal Exception
Program: E:\Games\World of Warcraft\WoW.exe
Exception: 0xC0000005 (ACCESS_VIOLATION) at 001B:0070211C
The instruction at "0x0070211C" referenced memory at "0x00000008".
The memory could not be "read".
-----
This application has encountered a critical error:
ERROR #132 (0x85100084) Fatal Exception
Program: J:\Burning Crusade Closed Beta\WoW.exe
Exception: 0xC0000005 (ACCESS_VIOLATION) at 001B:00790D67
The instruction at "0x00790D67" referenced memory at "0x0000001C".
The memory could not be "read".
------- The Test Addon ------
TestFrame_Name = "MyTestFrame" .. time(); -- Unique frame name each run
function TestFrame_Test()
local point, relativeTo, relativePoint, xOffset, yOffset = TestFrame_Frame:GetPoint(1);
local t = type(relativeTo);
local f = DEFAULT_CHAT_FRAME;
f:AddMessage(" ");
f:AddMessage("Point=" .. point);
f:AddMessage("type(relativeTo)=" .. (t or "nil"));
f:AddMessage("relativePoint=" .. relativePoint);
f:AddMessage("xOffset=" .. xOffset);
f:AddMessage("yOffset=" .. yOffset);
if (relativeTo) then
f:AddMessage("GetName(relativePoint)=" .. relativeTo:GetName());
end
end
function TestFrame_DragStart()
TestFrame_Frame:StartMoving();
end
function TestFrame_DragStop()
TestFrame_Frame:StopMovingOrSizing();
end
function TestFrame_CreateFrame()
local f = CreateFrame("Frame", TestFrame_Name, UIParent);
TestFrame_Frame = f;
f:SetFrameStrata("BACKGROUND");
f:SetWidth(300);
f:SetHeight(128);
f:EnableMouse(1);
f:SetMovable(1);
f:RegisterForDrag("LeftButton");
f:SetScript("OnDragStart", TestFrame_DragStart);
f:SetScript("OnDragStop", TestFrame_DragStop);
local t = f:CreateTexture(nil, "BACKGROUND");
t:SetTexture(1, 1, 1, 1);
t:SetAllPoints(f);
f:ClearAllPoints();
f:SetPoint("CENTER", "UIParent", "CENTER", 0, 0)
f:Show()
end
function TestFrame_CreateButton()
local b = CreateFrame("Button", NIL, TestFrame_Frame, "GameMenuButtonTemplate");
b:SetWidth(180);
b:SetHeight(50);
b:SetScript("OnClick", TestFrame_Test);
b:ClearAllPoints();
b:SetPoint("CENTER", TestFrame_Frame, "CENTER", 0, 0);
b:SetText("Print GetPoint");
b:Show();
end
TestFrame_CreateFrame();
TestFrame_CreateButton();
TestFrame_Test();