From cdd6fe2936c2e5e7504cae41c991ce97c267332e Mon Sep 17 00:00:00 2001 From: Dullson Date: Wed, 28 Dec 2022 19:29:58 +0300 Subject: [PATCH] Fix Trader memoryleak caused by OnFrame functions (#5473) * fix(pobtrader): memoryleak caused by unsubbed OnFrame functions * style(pobtrader): fix indentation --- src/Classes/TradeQuery.lua | 8 +++++--- src/Classes/TradeQueryGenerator.lua | 3 --- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Classes/TradeQuery.lua b/src/Classes/TradeQuery.lua index ab8743ec6c..5fa66d59ff 100644 --- a/src/Classes/TradeQuery.lua +++ b/src/Classes/TradeQuery.lua @@ -39,9 +39,9 @@ local TradeQueryClass = newClass("TradeQuery", function(self, itemsTab) self.pbLeagueIndex = 1 self.tradeQueryRequests = new("TradeQueryRequests", self) - table.insert(main.onFrameFuncs, function() + main.onFrameFuncs["TradeQueryRequests"] = function() self.tradeQueryRequests:ProcessQueue() - end) + end -- set self.storedGlobalCacheDPSView = GlobalCache.useFullDPS @@ -185,7 +185,9 @@ end -- Opens the item pricing popup function TradeQueryClass:PriceItem() self.tradeQueryGenerator = new("TradeQueryGenerator", self) - + main.onFrameFuncs["TradeQueryGenerator"] = function() + self.tradeQueryGenerator:OnFrame() + end -- Count number of rows to render local row_count = 3 + #baseSlots -- Count sockets diff --git a/src/Classes/TradeQueryGenerator.lua b/src/Classes/TradeQueryGenerator.lua index 46065aa164..735028131e 100644 --- a/src/Classes/TradeQueryGenerator.lua +++ b/src/Classes/TradeQueryGenerator.lua @@ -77,9 +77,6 @@ local TradeQueryGeneratorClass = newClass("TradeQueryGenerator", function(self, self.itemsTab = queryTab.itemsTab self.calcContext = { } - table.insert(main.onFrameFuncs, function() - self:OnFrame() - end) end) local function fetchStats()