View Single Post
06-22-16, 11:41 AM   #1
maqjav
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Feb 2012
Posts: 60
Crash using texture references

For the last couple of days I've been making different tests with the next code. It draws a line of items in the screen and every icon has a tooltip to show the info of the item.

Code:
local itemFrames = {}

for i=1, MAX_ITEMS_LOOT_BAR do 
	local itemFrame = _G.CreateFrame("Frame", "LootBarItem"..i, mainFrame.LootBar)
	itemFrame:SetSize(20, 20)
	itemFrame:SetPoint("LEFT", (5+16)* (i-1), 0)
	-- icon
	itemFrame.texture = itemFrame:CreateTexture()
	itemFrame.texture:SetAllPoints(itemFrame)
	-- tooltip
	itemFrame:SetScript("OnEnter", function(self)
		if self.link then
			GameTooltip:SetOwner(mainFrame, "ANCHOR_LEFT")
			GameTooltip:SetHyperlink(self.link)
			GameTooltip:Show()
		end
	end)
	itemFrame:SetScript("OnLeave", function(self)
		if self.link then
			GameTooltip:Hide()
		end
	end)
					
	itemFrames[i] = itemFrame
end
This icons are updated from another method every time I find a NPC. I get a list of itemsIDs from a local table and calling to GetItemInfo() I extract the texture and the hyperlink that I use with the previous frames.

Code:
	-- hide previous icons
	for i, itemFrame in ipairs(itemFrames) do
		if itemFrame:IsShown() then
			itemFrame:Hide()
		end
	end

	-- loop recovering 1-9 itemsMax, calling GetItemInfo() and on event GET_ITEM_INFO_RECEIVED:
	itemFrames[i].texture:SetTexture(itemTexture)
	itemFrames[i].link = itemHyperlink
	itemFrames[i]:Show()
Radomnly the client will crash while updating the icons, the most of the times if a tooltip is open (although it does happend with the tooltip close)

Here is the last log I got (If you want it complete let me know).
In this case I had the mouse on top of the first frame (LootBarItem1):

Code:
This application has encountered a critical error:

ERROR #0 (0x85100000) Assertion failure!

Program:	G:\World of Warcraft Public Test\WowT-64.exe
ProcessID:	4428
File:	CSimpleRender.cpp
Line:	792
Expr:	"renderable.GetGXTex() == TextureGetGxTexUnsafe(renderable.m_simpleTexture->GetHTEXTURE())", buffer = "Frame: nullptr, STex: LootBarItem1.texture, R-GXTEX: 0000010ec5ed1b9c, H-GXTEX: 0000000000000000, IsRFallback: false, IsRStub: false, IsHFallback: false, IsHStub: false"
Yesterday this was the error I was getting now and then. After updating to the last build I get this new error more often (it doesn't give much information).


Last edited by maqjav : 06-22-16 at 01:17 PM.