Avoid hooksecurefunc when TooltipDataProcessor is available
hooksecurefunc
on GameTooltip
, specifically the SetBagItem
one, has a performance issue when sorting the bags. It's called once per item being sorted, which on a large sorting operation can cause the game client to freeze for long enough that Windows offers to close the game.
I changed the code in tooltips.lua
to read like so:
if TooltipDataProcessor then
TooltipDataProcessor.AddTooltipPostCall(Enum.TooltipDataType.Item, CanIMogIt_AttachItemTooltip)
else
hooksecurefunc(GameTooltip, "SetMerchantItem",
function(tooltip, index)
addToTooltip(tooltip, GetMerchantItemLink(index))
VVDebugPrint(tooltip, "SetMerchantItem")
end
)
[...]
end
and in my personal testing I've experienced no ill effects.