6 - Recent change in CBH breaks LibBars
A recent change in CallbackHandler added some internal stuff that breaks the way LibBars clears all registrations. The below patch reportedly fixes the issue:
Index: LibBars-1.0.lua
===================================================================
--- LibBars-1.0.lua (revision 17)
+++ LibBars-1.0.lua (working copy)
@@ -1059,21 +1059,15 @@
self.timerLabel:SetFont(f s or 10, m)
-- Cancel all registered callbacks. CBH doesn't seem to provide a method to do this.
- if self.callbacks.insertQueue then
- for eventname, callbacks in pairs(self.callbacks.insertQueue do
- for k, v in pairs(callbacks) do
- callbacks[k] = nil
- end
- end
- end
- for eventname, callbacks in pairs(self.callbacks.events do
- for k, v in pairs(callbacks) do
- callbacks[k] = nil
- end
- if self.callbacks.OnUnused then
- self.callbacks.OnUnused(self.callbacks, target, eventname)
- end
- end
+ local listeners = {}
+ for eventname, callbacks in pairs(self.callbacks.events do
+ for listener, callback in pairs(callbacks) do
+ listeners[listener] = true
+ end
+ end
+ for listener, _ in pairs(listeners) do
+ self.UnregisterAllCallbacks(listener)
+ end
end
function barPrototype:GetGroup()
| User | When | Change |
|---|---|---|
| mitch0 | Fri, 18 Sep 2009 06:59:47 | Create |
- 1 comment
- 1 comment
Facts
- Last updated on
- 14 Nov 2009
- Reported on
- 18 Sep 2009
- Status
- New - Issue has not had initial review yet.
- Type
- Defect - A shortcoming, fault, or imperfection
- Priority
- Medium - Normal priority.
- #1
mikk Fri, 18 Sep 2009 23:59:52This patch is semi-broken in that it doesn't examine the insertQueue.
Either way, digging into the innards of CBH like this is something that (for now obvious reasons i hope) you should never do. I'm thinking adding an :UnregisterAll() on the registry object is the way to go.
Though, I must ask, why is this even needed? An operation like this causes clients to not receive any further callbacks at all, perhaps in a situation where they have internal state EXPECTING callbacks?