From 866d9621cb81f1ae1a7f226afc9ae831233dce7c Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 21 Sep 2013 22:16:44 +0200 Subject: [PATCH] Create new listener list --- couchpotato/core/notifications/core/main.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/notifications/core/main.py b/couchpotato/core/notifications/core/main.py index a9a20b0a..04acf284 100644 --- a/couchpotato/core/notifications/core/main.py +++ b/couchpotato/core/notifications/core/main.py @@ -198,13 +198,16 @@ class CoreNotifier(Notification): def removeListener(self, callback): self.m_lock.acquire() + new_listeners = [] for list_tuple in self.listeners: try: listener, last_id = list_tuple - if listener == callback: - self.listeners.remove(list_tuple) + if listener != callback: + new_listeners.append(list_tuple) except: log.debug('Failed removing listener: %s', traceback.format_exc()) + + self.listeners = new_listeners self.m_lock.release() def cleanMessages(self):