From: Ed Page Date: Fri, 12 Feb 2010 12:44:21 +0000 (-0600) Subject: Fixing a bug referencing a non-existent variable X-Git-Url: http://git.maemo.org/git/?p=theonering;a=commitdiff_plain;h=f98041e8376b345ae5b02804d66babc7f81ab319 Fixing a bug referencing a non-existent variable --- diff --git a/src/gvoice/state_machine.py b/src/gvoice/state_machine.py index 4dcd809..514fb92 100644 --- a/src/gvoice/state_machine.py +++ b/src/gvoice/state_machine.py @@ -294,7 +294,7 @@ class UpdateStateMachine(StateMachine): self._reset_timers() def _reset_timers(self, initialize=False): - if self._timeoutId is None: + if self._onTimeout.is_running(): return # not started yet _moduleLogger.info("%s Resetting State Machine" % (self._name, )) self._onTimeout.cancel() diff --git a/src/util/go_utils.py b/src/util/go_utils.py index 47fb16b..e8fde8b 100644 --- a/src/util/go_utils.py +++ b/src/util/go_utils.py @@ -69,6 +69,9 @@ class Async(object): else: self.__idleId = gobject.idle_add(self.__func) + def is_running(self): + return self.__idleId is not None + def cancel(self): if self.__idleId is not None: gobject.source_remove(self.__idleId) @@ -103,6 +106,9 @@ class Timeout(object): else: timeout_add_seconds(timeoutInSeconds, self._on_once) + def is_running(self): + return self.__timeoutId is not None + def cancel(self): if self.__timeoutId is not None: gobject.source_remove(self.__timeoutId)