[kupfer] scheduler: Use gobject_connect_weakly in Timer



commit c7292bd0b056295b3538649396fc63c9b3348a2d
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Fri Dec 25 00:59:03 2009 +0100

    scheduler: Use gobject_connect_weakly in Timer
    
    Connect weakly to the finish signal to not keep Timer objects around
    after they are unreferenced (both unreferenced from the creator, as
    well as no outstanding deadline).

 kupfer/scheduler.py |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/scheduler.py b/kupfer/scheduler.py
index 66b1e83..41dc358 100644
--- a/kupfer/scheduler.py
+++ b/kupfer/scheduler.py
@@ -2,6 +2,7 @@
 import gobject
 
 from kupfer import pretty
+from kupfer.helplib import gobject_connect_weakly
 
 _scheduler = None
 
@@ -35,7 +36,7 @@ class Timer (object):
 		self._current_timer = -1
 		self._call_at_finish = call_at_finish
 		self._current_callback = None
-		GetScheduler().connect("finish", self._on_finish)
+		gobject_connect_weakly(GetScheduler(), "finish", self._on_finish)
 
 	def set(self, timeout_seconds, callback, *arguments):
 		"""Setup timer to call @timeout_seconds in the future.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]