Thread: Reuse frame
View Single Post
06-21-16, 11:13 AM   #8
maqjav
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Feb 2012
Posts: 60
I've been playing with tooltips and it seems that the client crash is related.

I can make it crash if I'm showing a list of icons, I put the mouse on top of one (the tooltip shows up) and then I try to reload the bar with new icons.

Code:
local itemFrames = {}
for i=1, 5 do 
	local frame = _G.CreateFrame("Frame", "ItemFrame"..i, mainFrame)
	frame:SetSize(20, 20)
	frame:SetPoint("LEFT", (5+16)* (i-1), 0)
	frame.texture = frame:CreateTexture()
	frame.texture:SetAllPoints(frame)

	-- set tooltip
	frame:SetScript("OnEnter", function(self)
		if self.link then
			GameTooltip:SetOwner(self, "ANCHOR_LEFT")
			GameTooltip:SetHyperlink(self.link)
			GameTooltip:Show()
		end
	end)
	frame:SetScript("OnLeave", function(self)
		if self.link then
			GameTooltip:Hide()
		end
	end)

	itemFrames[i] = frame
end
And in my loadItems method I update the hyperlink extracting it from GetItemInfo.

Without the "OnEnter" and "OnLeave" methods seems pretty stable, however with them, the crash always ocurrs with the second call to "loadItems" (only if the tooltip is visible).

I'm trying to make a little example to demostrate this crash, let's see what I get, this issue is making me crazy.