Good Evening everyone,
I wanted to inquire about an issue I am having with an addon I am creating/modifying.
I used to use Shadowed's DamnChatTabs addon to hide the chat frame tabs, but considering I never utilized it to toggle tab visibility, just hiding them, I decided to cut the saved variables out, and bring it up to current standards (getglobal() being deprecated and the like).
Everything is going....well, it works fine, but whenever I mouseover the chat window, the addon memory increases by around 30kb every time, and I can cause this to continue infinitely. After a while it does return to a reasonable level (never less than after I first log in/reload the UI).
Can anyone shed any light on why the memory continues to increase with no end?
Lua Code:
--[[
Nearly -ALL- credit goes to Shadowed's DamnChatTabs addon.
I have stripped the code down, and modified it -SLIGHTLY- to disable
all chat tabs by default, and added support for hiding the pet battle tab.
]]--
local _G = _G
-- Function to determine the number of active chat windows, borrowed from Tekkub's FloatingChatFrame
local function GetNumActiveChatFrames()
local count = 0
local chatFrame
for i = 1, NUM_CHAT_WINDOWS do
chatFrame = _G["ChatFrame"..i]
if (chatFrame) then
if (shown or chatFrame.isDocked) then
count = count + 1
end
end
end
return count
end
local function hideTab(self)
if (self.tabHide and self.tabHooked) then
self:Hide()
end
end
local eventHandler = CreateFrame("Frame")
eventHandler:RegisterEvent("ADDON_LOADED")
-- frame:RegisterEvent("PET_BATTLE_OPENING_START") -- Event to hook for hiding the PetBattle Chat Tab (ChatFrame11Tab)
eventHandler:SetScript("OnEvent", function(self, event, addon)
if (event == "ADDON_LOADED" and addon == "ClamChatTabHider") then
for i = 1, GetNumActiveChatFrames() do
local frame = _G["ChatFrame"..i.."Tab"]
if (not frame.tabHooked) then
if (frame) then
if (frame:GetScript("OnShow")) then
frame:HookScript("OnShow", hideTab)
else
frame:SetScript("OnShow", hideTab)
end
frame.tabHide = true
frame.tabHooked = true
frame:Hide()
end
end
end
eventHandler:UnregisterEvent("ADDON_LOADED")
end
end)
Thanks so much for taking the time to help me.