Originally Posted by Clamsoda
Code:
if not InCombatLockdown() then
modifyMap()
else
local eventHandler = CreateFrame("Frame")
eventHandler:SetScript("OnEvent", modifyMap)
eventHandler:RegisterEvent("PLAYER_REGEN_ENABLED")
end
... I can't conditionally create the frame?
|
You can, but here's the thing -- that block of code is only read and executed once, when your addon loads. Since you are never considered InCombatLockdown() when your addon's files are first being read and executed, your code is modifying the map once, and never creating a frame.
You should just be able to call the
modifyMap function in the main chunk, instead of that whole do-end block at the end of your code (containing the above) since, again, InCombatLockdown() is never true when non-LoD addons are initially read.
Also, upvaluing
hooksecurefunc is pointless. The purpose of upvaluing global functions is to speed up access time, but the speed-up is so minute that it's only useful for functions that are potentially called hundreds of times per second inside an OnUpdate handler or COMBAT_LOG_EVENT_UNFILTERED event handler. For a function that you call once or twice during the loading process, the upvalue is just a (granted, minute) waste of disk space and memory.
As for the taint problem, I don't really know, but my first guess would be related to the dropdown menu stuff, since the dropdown menu system is basically a house of cards in a dark basement. Try using a secure post-hook instead:
Code:
local function dropdownScaleFix(self)
- ToggleDropDownMenu(nil, nil, self:GetParent())
+ if DropDownList1:IsVisible() then
DropDownList1:SetScale(mapScale)
+ end
end
and:
Code:
WorldMapContinentDropDownButton:HookScript("OnClick", dropdownScaleFix)
WorldMapZoneDropDownButton:HookScript("OnClick", dropdownScaleFix)