Quantcast

Defer creation of frame for tooltip-scanning until addon is loaded.

Johnny C. Lam [07-13-14 - 11:29]
Defer creation of frame for tooltip-scanning until addon is loaded.

git-svn-id: svn://svn.curseforge.net/wow/ovale/mainline/trunk@1527 d5049fe3-3747-40f7-a4b5-f36d6801af5f
Filename
OvaleEquipement.lua
diff --git a/OvaleEquipement.lua b/OvaleEquipement.lua
index 51214e5..8fafb25 100644
--- a/OvaleEquipement.lua
+++ b/OvaleEquipement.lua
@@ -61,11 +61,8 @@ local INVSLOT_WRIST = INVSLOT_WRIST
 -- Player's class.
 local _, self_class = API_UnitClass("player")

--- frame for tooltip-scanning
-local self_tooltip = API_CreateFrame("GameTooltip", addonName .. "ScanningTooltip", nil, "GameTooltipTemplate")
-do
-	self_tooltip:SetOwner(UIParent, "ANCHOR_NONE")
-end
+-- Frame for tooltip-scanning.
+local self_tooltip = nil
 local OVALE_ITEM_LEVEL_PATTERN = "^" .. strgsub(ITEM_LEVEL, "%%d", "(%%d+)")

 -- equipment slot names
@@ -415,6 +412,12 @@ end
 --</private-static-methods>

 --<public-static-methods>
+function OvaleEquipement:OnInitialize()
+	-- Create the tooltip used for scanning.
+	self_tooltip = API_CreateFrame("GameTooltip", addonName .. "ScanningTooltip", nil, "GameTooltipTemplate")
+	self_tooltip:SetOwner(UIParent, "ANCHOR_NONE")
+end
+
 function OvaleEquipement:OnEnable()
 	self:RegisterEvent("PLAYER_ENTERING_WORLD", "UpdateEquippedItems")
 	self:RegisterEvent("PLAYER_ALIVE", "UpdateEquippedItems")