Commits

Aleš Erjavec committed 7f9415b

Fixed Future watchers state update notification.

Comments (0)

Files changed (1)

Orange/OrangeWidgets/OWConcurrent.py

     def _set_state(self, state):
         if self._state != state:
             self._state = state
-            for w in self._watchers:
-                w(self, state)
+            for watcher in self._watchers:
+                watcher(self, state)
 
     def cancel(self):
         """
             elif self._state == Future.Canceled:
                 return True
             else:
-                self._state = Future.Canceled
+                self._set_state(Future.Canceled)
                 self._condition.notify_all()
 
         return True
         """
         with self._condition:
             self._result = result
-            self._state = Future.Finished
+            self._set_state(Future.Finished)
             self._condition.notify_all()
 
     def set_exception(self, exception):
         """
         with self._condition:
             self._exception = exception
-            self._state = Future.Finished
+            self._set_state(Future.Finished)
             self._condition.notify_all()
 
     def set_running_or_notify_cancel(self):
             if self._state == Future.Canceled:
                 return False
             elif self._state == Future.Pending:
-                self._state = Future.Running
+                self._set_state(Future.Running)
                 return True
             else:
                 raise Exception()