Quantcast WoWInterface - View Single Post - WorldMapFrame Tainting (Not Green Maps)
View Single Post
12-10-12, 01:20 AM   #2
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,616
Originally Posted by Clamsoda View Post
	if not InCombatLockdown() then
		local eventHandler = CreateFrame("Frame")
		eventHandler:SetScript("OnEvent", modifyMap)
... 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:

local function dropdownScaleFix(self)
-   ToggleDropDownMenu(nil, nil, self:GetParent())
+   if DropDownList1:IsVisible() then
+   end

    WorldMapContinentDropDownButton:HookScript("OnClick", dropdownScaleFix)
    WorldMapZoneDropDownButton:HookScript("OnClick", dropdownScaleFix)
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote