From 194d1291e1a3e7c82fedec54cbabd4843d698c4c Mon Sep 17 00:00:00 2001 From: bendikro Date: Mon, 13 Jul 2015 20:42:02 +0200 Subject: [PATCH] [Core] Emit ConfigValueChangedEvent only in started state --- deluge/component.py | 3 +++ deluge/core/preferencesmanager.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/deluge/component.py b/deluge/component.py index 74e5c53e1..60bfbd78e 100644 --- a/deluge/component.py +++ b/deluge/component.py @@ -183,6 +183,9 @@ class Component(object): d.addCallback(on_stop) return d + def get_state(self): + return self._component_state + def start(self): pass diff --git a/deluge/core/preferencesmanager.py b/deluge/core/preferencesmanager.py index f131d3171..95d9a693e 100644 --- a/deluge/core/preferencesmanager.py +++ b/deluge/core/preferencesmanager.py @@ -148,8 +148,9 @@ class PreferencesManager(component.Component): self.session.set_settings(settings) def _on_config_value_change(self, key, value): - self.do_config_set_func(key, value) - component.get("EventManager").emit(ConfigValueChangedEvent(key, value)) + if self.get_state() == "Started": + self.do_config_set_func(key, value) + component.get("EventManager").emit(ConfigValueChangedEvent(key, value)) def _on_set_torrentfiles_location(self, key, value): if self.config["copy_torrent_file"]: