Quantcast

event handler fixed

Steven Jackson [07-06-14 - 12:16]
event handler fixed
Filename
.gitignore
Interface/AddOns/SVUI/system/classes/Visibility.lua
Interface/AddOns/SVUI/system/system.lua
diff --git a/.gitignore b/.gitignore
index 89857aa..3e632da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
-
+*.md
 [Dd]ev*/
diff --git a/Interface/AddOns/SVUI/system/classes/Visibility.lua b/Interface/AddOns/SVUI/system/classes/Visibility.lua
index 09e14e4..0e80b7f 100644
--- a/Interface/AddOns/SVUI/system/classes/Visibility.lua
+++ b/Interface/AddOns/SVUI/system/classes/Visibility.lua
@@ -32,6 +32,7 @@ local SuperVillain, L = unpack(select(2, ...));
 LOCALS
 ##########################################################
 ]]--
+local DisplayEventHandler = CreateFrame("Frame");
 local SecureFadeManager = CreateFrame("Frame");
 local SecureFadeFrames = {};
 local StealthFrame = CreateFrame("Frame");
@@ -54,7 +55,7 @@ function SuperVillain:FlushDisplayAudit()
             _G[frame]:SetParent(StealthFrame)
         end
     end;
-    self:RegisterEvent("PLAYER_REGEN_DISABLED","PushDisplayAudit")
+    DisplayEventHandler:RegisterEvent("PLAYER_REGEN_DISABLED")
 end;

 function SuperVillain:PushDisplayAudit()
@@ -64,9 +65,15 @@ function SuperVillain:PushDisplayAudit()
             _G[frame]:SetParent(UIParent)
         end
     end;
-    self:UnregisterEvent("PLAYER_REGEN_DISABLED")
+    DisplayEventHandler:UnregisterEvent("PLAYER_REGEN_DISABLED")
 end;

+local DisplayAudit_OnEvent = function(self, event, arg, ...)
+    SuperVillain:PushDisplayAudit()
+end
+
+DisplayEventHandler:SetScript("OnEvent", DisplayAudit_OnEvent)
+
 function SuperVillain:SecureFade_OnUpdate(value)
     local i = 1;
     local this, safeFadeState;
diff --git a/Interface/AddOns/SVUI/system/system.lua b/Interface/AddOns/SVUI/system/system.lua
index d44a68a..352038b 100644
--- a/Interface/AddOns/SVUI/system/system.lua
+++ b/Interface/AddOns/SVUI/system/system.lua
@@ -320,7 +320,7 @@ function SuperVillain:ToggleConfig()
 	GameTooltip:Hide()
 end

-function SuperVillain:TaintHandler(taint,sourceName,sourceFunc)
+function SuperVillain:TaintHandler(taint, sourceName, sourceFunc)
 	if GetCVarBool('scriptErrors') ~= 1 then return end
 	ScriptErrorsFrame_OnError(L["%s: %s has lost it's damn mind and is destroying '%s'."]:format(taint, sourceName or "<name>", sourceFunc or "<func>"),false)
 end
@@ -461,8 +461,8 @@ SVUISystemEventHandler:RegisterEvent("PLAYER_LOGIN")
 EVENT HANDLER
 ##########################################################
 ]]--
-local Registry_OnEvent = function(self, event, arg1)
-	if(event == "ADDON_LOADED"  and arg1 ~= "Blizzard_DebugTools") then
+local Registry_OnEvent = function(self, event, arg, ...)
+	if(event == "ADDON_LOADED"  and arg ~= "Blizzard_DebugTools") then
 		PreLoad(SuperVillain)
 		self:UnregisterEvent("ADDON_LOADED")
 	elseif(event == "PLAYER_LOGIN" and IsLoggedIn()) then
@@ -500,7 +500,7 @@ local Registry_OnEvent = function(self, event, arg1)
 	elseif(event == "PET_BATTLE_OPENING_START") then
 		SuperVillain:FlushDisplayAudit()
 	elseif(event == "ADDON_ACTION_BLOCKED" or event == "ADDON_ACTION_FORBIDDEN") then
-		SuperVillain:TaintHandler()
+		SuperVillain:TaintHandler(arg, ...)
 	elseif(event == "PLAYER_REGEN_DISABLED") then
 		local forceClosed=false;
 		if IsAddOnLoaded("SVUI_ConfigOMatic") then