Fix preferencesmanager from failing to stop when trying to stop

loopingcall that wasn't started
This commit is contained in:
Andrew Resch 2011-06-18 20:13:58 -07:00
parent a82c753ac0
commit c64ed6adc5
1 changed files with 3 additions and 3 deletions

View File

@ -166,7 +166,7 @@ class PreferencesManager(component.Component):
self.config.register_change_callback(self._on_config_value_change) self.config.register_change_callback(self._on_config_value_change)
def stop(self): def stop(self):
if self.new_release_timer: if self.new_release_timer and self.new_release_timer.running:
self.new_release_timer.stop() self.new_release_timer.stop()
# Config set functions # Config set functions
@ -417,14 +417,14 @@ class PreferencesManager(component.Component):
if value: if value:
log.debug("Checking for new release..") log.debug("Checking for new release..")
threading.Thread(target=self.core.get_new_release).start() threading.Thread(target=self.core.get_new_release).start()
if self.new_release_timer: if self.new_release_timer and self.new_release_timer.running:
self.new_release_timer.stop() self.new_release_timer.stop()
# Set a timer to check for a new release every 3 days # Set a timer to check for a new release every 3 days
self.new_release_timer = LoopingCall( self.new_release_timer = LoopingCall(
self._on_set_new_release_check, "new_release_check", True) self._on_set_new_release_check, "new_release_check", True)
self.new_release_timer.start(72 * 60 * 60, False) self.new_release_timer.start(72 * 60 * 60, False)
else: else:
if self.new_release_timer: if self.new_release_timer and self.new_release_timer.running:
self.new_release_timer.stop() self.new_release_timer.stop()
def _on_set_proxies(self, key, value): def _on_set_proxies(self, key, value):