Verified Commit 9c2c9c05 authored by Merathilis's avatar Merathilis
Browse files

Updated oUF

parent bcd3b84d
......@@ -753,14 +753,20 @@ end
local function unregisterEvents(fontstr)
for event, data in next, events do
for i, tagfsstr in next, data do
local index = 1
local tagfsstr = data[index]
while tagfsstr do
if(tagfsstr == fontstr) then
if(#data == 1) then
eventFrame:UnregisterEvent(event)
end
tremove(data, i)
table.remove(data, index)
else
index = index + 1
end
tagfsstr = data[index]
end
end
end
......@@ -910,10 +916,16 @@ local function Untag(self, fs)
unregisterEvents(fs)
for _, timers in next, eventlessUnits do
for i, fontstr in next, timers do
local index = 1
local fontstr = timers[index]
while fontstr do
if(fs == fontstr) then
tremove(timers, i)
tremove(timers, index)
else
index = index + 1
end
fontstr = timers[index]
end
end
......
......@@ -4,6 +4,7 @@ local Private = oUF.Private
local argcheck = Private.argcheck
local error = Private.error
local validateEvent = Private.validateEvent
local validateUnit = Private.validateUnit
local frame_metatable = Private.frame_metatable
......@@ -104,8 +105,8 @@ function frame_metatable.__index:RegisterEvent(event, func, unitless)
argcheck(func, 3, 'function')
local curev = self[event]
local kind = type(curev)
if(curev) then
local kind = type(curev)
if(kind == 'function' and curev ~= func) then
self[event] = setmetatable({curev, func}, event_metatable)
elseif(kind == 'table') then
......@@ -119,11 +120,12 @@ function frame_metatable.__index:RegisterEvent(event, func, unitless)
if(unitless or self.__eventless) then
-- re-register the event in case we have mixed registration
registerEvent(self, event)
if(self.unitEvents) then
self.unitEvents[event] = nil
end
end
else
elseif(validateEvent(event)) then
self[event] = func
if(not self:GetScript('OnEvent')) then
......
......@@ -61,3 +61,20 @@ function Private.unitSelectionType(unit, considerHostile)
return selectionTypes[UnitSelectionType(unit, true)]
end
end
local function errorHandler(...)
return geterrorhandler()(...)
end
function Private.xpcall(func, ...)
return xpcall(func, errorHandler, ...)
end
function Private.validateEvent(event)
local isOK = xpcall(validator.RegisterEvent, errorHandler, validator, event)
if(isOK) then
validator:UnregisterEvent(event)
end
return isOK
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment