Thread Tools Display Modes
Prev Previous Post   Next Post Next
12/16/14, 02:31 PM   #1
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,579
cannot unregister EVENT_RAID_SCORE_NOTIFICATION_*

I am currently playing around with the notification system and have encountered some strangeness that I cannot explain to myself.
My test setup:

Lua Code:
  1. ZO_PreHook(CHAT_SYSTEM, "OnNumNotificationsChanged", function(self, totalNumNotifications)
  2.     d("changed from " .. tostring(self.currentNumNotifications) .. " to " .. totalNumNotifications)
  3.     if(totalNumNotifications > 0) then error("test") end
  4. end)
  5.  
  6. zo_callLater(function()
  7.     d(NOTIFICATIONS.eventNamespace)
  8.     d(EVENT_MANAGER:UnregisterForEvent(NOTIFICATIONS.eventNamespace, EVENT_RAID_SCORE_NOTIFICATION_ADDED))
  9.     d(EVENT_MANAGER:UnregisterForEvent(NOTIFICATIONS.eventNamespace, EVENT_RAID_SCORE_NOTIFICATION_REMOVED))
  10.  
  11.     EVENT_MANAGER:RegisterForEvent("test", EVENT_RAID_SCORE_NOTIFICATION_ADDED, function() d("add event") end)
  12.     EVENT_MANAGER:RegisterForEvent("test", EVENT_RAID_SCORE_NOTIFICATION_REMOVED, function() d("remove event") end)
  13. end, 1000)

I expect this to hide the raid notifications until some other event refreshes the notification manager.
When I load the addon I get:
Code:
KeyboardNotifications
true
true
Which means it has unregistered both events successfully, but instead of ignoring the raid notifications it still handles them as if I never unregistered the event.
When I already have got some of them in my notifications panel and press the delete button, it shows
Code:
remove event
changed from 4 to 3
and then throws my error with the following stack traceback:
Code:
	[C]: in function 'error'
	user:/AddOns/test/test.lua:42: in function 'hookFunction'
	EsoUI/Libraries/Utility/ZO_Hook.lua:19: in function 'OnNumNotificationsChanged'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:705: in function 'ZO_NotificationManager:BuildNotificationList'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:678: in function 'ZO_NotificationManager:RefreshNotificationList'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:58: in function 'ZO_NotificationProvider:PushUpdateToNotificationManager'
	EsoUI/Ingame/Contacts/Notifications_Common.lua:34: in function '(anonymous)'
When I let myself get killed and revive, it also throws the same error two times in a row.

Notifications_Common.lua:34 is inside the handler function that gets registered to both events in question and is - as far as I can see - never used anywhere else.

Maybe somebody can explain to me what is happening.
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » cannot unregister EVENT_RAID_SCORE_NOTIFICATION_*


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off