From c5903bda6f2d99bda363a222caeef8a463de17f8 Mon Sep 17 00:00:00 2001 From: TOM_RUS Date: Sat, 7 Nov 2020 04:39:21 +0300 Subject: [PATCH] WOW-36532patch9.0.2_Beta --- .../Blizzard_CovenantPreviewUI.lua | 7 +++++- .../Blizzard_CovenantMissionTemplates.xml | 2 +- Interface/SharedXML/CircularBuffer.lua | 24 +++++++++++++++---- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/Interface/AddOns/Blizzard_CovenantPreviewUI/Blizzard_CovenantPreviewUI.lua b/Interface/AddOns/Blizzard_CovenantPreviewUI/Blizzard_CovenantPreviewUI.lua index a9e0f234..f16a7526 100644 --- a/Interface/AddOns/Blizzard_CovenantPreviewUI/Blizzard_CovenantPreviewUI.lua +++ b/Interface/AddOns/Blizzard_CovenantPreviewUI/Blizzard_CovenantPreviewUI.lua @@ -308,7 +308,7 @@ function CovenantSoulbindButtonMixin:OnEnter() GameTooltip:Hide(); local spell = Spell:CreateFromSpellID(self.spellID); - spell:ContinueOnSpellLoad(function() + self.spellDataLoadedCancelCallback = spell:ContinueWithCancelOnSpellLoad(function() EmbeddedItemTooltip:SetOwner(self, "ANCHOR_RIGHT", -12, -10); GameTooltip_AddHighlightLine(EmbeddedItemTooltip, self.name); GameTooltip_AddBlankLineToTooltip(EmbeddedItemTooltip); @@ -316,11 +316,16 @@ function CovenantSoulbindButtonMixin:OnEnter() GameTooltip_AddBlankLineToTooltip(EmbeddedItemTooltip); EmbeddedItemTooltip_SetSpellWithTextureByID(EmbeddedItemTooltip.ItemTooltip, self.spellID, spell:GetSpellTexture()); EmbeddedItemTooltip:Show(); + self.spellDataLoadedCancelCallback = nil; end); end function CovenantSoulbindButtonMixin:OnLeave() EmbeddedItemTooltip:Hide(); + if self.spellDataLoadedCancelCallback then + self.spellDataLoadedCancelCallback(); + self.spellDataLoadedCancelCallback = nil; + end end CovenantPreviewModelSceneContainerMixin = { }; diff --git a/Interface/AddOns/Blizzard_GarrisonTemplates/Blizzard_CovenantMissionTemplates.xml b/Interface/AddOns/Blizzard_GarrisonTemplates/Blizzard_CovenantMissionTemplates.xml index 054b155e..96b24e1f 100644 --- a/Interface/AddOns/Blizzard_GarrisonTemplates/Blizzard_CovenantMissionTemplates.xml +++ b/Interface/AddOns/Blizzard_GarrisonTemplates/Blizzard_CovenantMissionTemplates.xml @@ -58,7 +58,7 @@ - + diff --git a/Interface/SharedXML/CircularBuffer.lua b/Interface/SharedXML/CircularBuffer.lua index d52a5c80..c5460141 100644 --- a/Interface/SharedXML/CircularBuffer.lua +++ b/Interface/SharedXML/CircularBuffer.lua @@ -1,3 +1,17 @@ +local securecall = securecall; +local type = type; +local error = error; +local CreateFromMixins = CreateFromMixins; + +local function safesecurecall(fn, ...) + if type(fn) ~= "function" then + error("Function lookups forbidden"); + return; + end + + return securecall(fn, ...); +end + CircularBufferMixin = {} function CreateCircularBuffer(maxElements) @@ -31,10 +45,10 @@ end function CircularBufferMixin:PushFront(element) self.headIndex = self.headIndex + 1; - + local insertIndex = self.headIndex; self.elements[insertIndex] = element; - + self.headIndex = self.headIndex % self.maxElements; return insertIndex; @@ -68,7 +82,7 @@ function CircularBufferMixin:RemoveIf(predicateFunction, transformFunction) transformFunction = transformFunction or PassThrough; local elements = {}; for i, entry in self:EnumerateIndexedEntries() do - if not securecall(predicateFunction, securecall(transformFunction, entry)) then + if not safesecurecall(predicateFunction, safesecurecall(transformFunction, entry)) then elements[#elements + 1] = entry; end end @@ -85,8 +99,8 @@ function CircularBufferMixin:TransformIf(predicateFunction, transformFunction, e entryTransform = entryTransform or PassThrough; for i, entry in ipairs(self.elements) do - if securecall(predicateFunction, securecall(entryTransform, entry)) then - self.elements[i] = securecall(transformFunction, securecall(entryTransform, entry)); + if safesecurecall(predicateFunction, safesecurecall(entryTransform, entry)) then + self.elements[i] = safesecurecall(transformFunction, safesecurecall(entryTransform, entry)); changed = true; end end -- GitLab