#7 Allow an eventmanager receiver to add or remove connections

closed-accepted
nobody
None
5
2010-04-14
2010-04-08
Alex
No

If a receiver function called by eventmanager wants to add or remove connections to other events, this would change the
receivers dictionary while iterating it. This may cause subtle bugs (some receivers would not get called for no aparent reason).

for rec in receivers:
if rec.receiver(*params, **keyargs): # if receiver calls eventmanager.connect() or .disconnect(), this would change the receivers dictionary

The fix was to iterate over a copy of the dictionary:

for rec in copy(receivers):
...

Alex

Discussion

  • Matthias Baas
    Matthias Baas
    2010-04-14

    This is applied. Thanks!
    I have also added a unit test for the module that checks this bug.

     
  • Matthias Baas
    Matthias Baas
    2010-04-14

    • status: open --> closed-accepted