From: Matthew N. <mni...@di...> - 2008-04-24 20:06:51
|
On Fri, 2008-04-18 at 23:09 +0200, Jan Müller wrote: > hi, > > triggered by the recent mailing list activities, i just began to scan > the code of manager.py, and i found this: > > def event_dispatch(self): > """This thread is responsible fore dispatching events""" > > # loop dispatching events > while self._running.isSet(): > # get/wait for an event > ev = self._event_queue.get() > > # if we got None as an event, we are finished > if not ev: > break > > # dispatch our events > > # first build a list of the functions to execute > callbacks = self._event_callbacks.get(ev.name, []) > callbacks.extend(self._event_callbacks.get('*', [])) # <- !!! > > # now execute the functions > for callback in callbacks: > if callback(ev, self): > break > > what happens here is that the '*' callback handlers are explicitly added > to the (mutable) list of ev.name handlers. > i haven't tried it but this should lead to problems when unsubscribing a > '*' handler since it still remains an > ev.name handler. i suggest a list addition to prevent manipulation of > the list of ev.name handlers: > > [...] > # first build a list of the functions to execute > callbacks = self._event_callbacks.get(ev.name, []) + > self._event_callbacks.get('*', []) > [...] This is a potential problem. In theory, if I understand what you are saying correctly, each time an event is handled the '*' callback list should get appended to the ev.name list. -- Matthew Nicholson Digium |