Commit 24dde88a authored by Rainrider's avatar Rainrider

core: unregister the event when unit validation fails

parent 0cfb7a89
......@@ -134,14 +134,13 @@ function frame_metatable.__index:UnregisterEvent(event, func)
for k, infunc in next, curev do
if(infunc == func) then
curev[k] = nil
if(not next(curev)) then
cleanUp = true
end
break
end
end
if(not next(curev)) then
cleanUp = true
end
end
if(cleanUp or curev == func) then
......
......@@ -29,12 +29,10 @@ local validator = CreateFrame('Frame')
function Private.validateUnit(unit)
local isOK, _ = pcall(validator.RegisterUnitEvent, validator, 'UNIT_HEALTH', unit)
if isOK then
if(isOK) then
_, unit = validator:IsEventRegistered('UNIT_HEALTH')
if unit then
validator:UnregisterEvent('UNIT_HEALTH')
validator:UnregisterEvent('UNIT_HEALTH')
return true
end
return not not unit
end
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