Handle subscribed callbacks unregistering themselves.
authorFredrik Tolf <fredrik@dolda2000.com>
Sun, 2 Nov 2014 02:10:10 +0000 (03:10 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Sun, 2 Nov 2014 02:10:10 +0000 (03:10 +0100)
pdm/perf.py

index fd4daa6..7aef95a 100644 (file)
@@ -129,7 +129,7 @@ class eventobj(perfobj):
 
     def notify(self, event):
         """Notify all subscribers with the given event object."""
-        for cb in self.subscribers:
+        for cb in list(self.subscribers):
             try:
                 cb(event)
             except: pass