Fixed a bug in timer handling. Fixes #151

This commit is contained in:
Manuel Cortez 2017-07-30 01:16:41 -05:00
parent 696b6aa11d
commit 5a249ba942

View File

@ -931,8 +931,8 @@ class Controller(object):
self.view.insert_buffer(buffer.buffer, name=_(u"Trending topics for %s") % (trends.get_string()), pos=pos) self.view.insert_buffer(buffer.buffer, name=_(u"Trending topics for %s") % (trends.get_string()), pos=pos)
self.buffers.append(buffer) self.buffers.append(buffer)
buffer.start_stream() buffer.start_stream()
timer = RepeatingTimer(300, buffer.start_stream) buffer.timer = RepeatingTimer(300, buffer.start_stream)
timer.start() buffer.timer.start()
buffer.session.settings["other_buffers"]["trending_topic_buffers"].append(woeid) buffer.session.settings["other_buffers"]["trending_topic_buffers"].append(woeid)
buffer.session.settings.write() buffer.session.settings.write()
@ -987,9 +987,10 @@ class Controller(object):
buff = self.view.search(buffer.name, buffer.account) buff = self.view.search(buffer.name, buffer.account)
answer = buffer.remove_buffer() answer = buffer.remove_buffer()
if answer == False: return if answer == False: return
if hasattr(buff, "timer"): log.debug("destroying buffer...")
if hasattr(buffer, "timer"):
log.debug("Stopping timer...") log.debug("Stopping timer...")
buff.timer.cancel() buffer.timer.cancel()
log.debug("Timer cancelled.") log.debug("Timer cancelled.")
self.right() self.right()
self.view.delete_buffer(buff) self.view.delete_buffer(buff)