fix model bug when using unit api

This commit is contained in:
Bunny67
2020-07-04 16:58:49 +03:00
parent 2e69774104
commit 1d0aeb765b
+5 -1
View File
@@ -92,10 +92,13 @@ local function CreateModel()
end
-- Keep the two model apis separate
local pool = CreateObjectPool(CreateModel)
local poolModelApi = CreateObjectPool(CreateModel)
local poolUnitApi = CreateObjectPool(CreateModel)
local function AcquireModel(region, data)
local pool = data.modelIsUnit and poolUnitApi or poolModelApi
local model = pool:Acquire()
model.modelIsUnit = data.modelIsUnit
model:ClearAllPoints()
model:SetAllPoints(region)
@@ -152,6 +155,7 @@ local function ReleaseModel(model)
model:UnregisterEvent("PLAYER_TARGET_CHANGED");
model:UnregisterEvent("PLAYER_FOCUS_CHANGED");
model:SetScript("OnEvent", nil);
local pool = model.modelIsUnit and poolUnitApi or poolModelApi
pool:Release(model)
end