Correctly terminating the timer

This commit is contained in:
Artem Glebov 2013-04-16 10:13:50 +03:00
parent ce23147d3f
commit 7d1d517102

View file

@ -113,7 +113,8 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
list.addItem(item)
list.setEnabled(bool(self.torrents))
# Update again, after an interval
# Update again, after an interval, but only if the timer has not been cancelled
if self.timer:
self.timer = threading.Timer(UPDATE_INTERVAL, self.updateTorrents)
self.timer.start()
def onClick(self, controlID):
@ -225,6 +226,7 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog):
def close(self):
if self.timer:
self.timer.cancel()
self.timer = None
super(TransmissionGUI, self).close()