Skip to content

Commit

Permalink
Merge pull request #4320 from PrimozGodec/concurrent-fix
Browse files Browse the repository at this point in the history
Concurrent: Prevent running new task from on_done, on_exception
  • Loading branch information
VesnaT authored Jan 24, 2020
2 parents 148959e + a33f9c4 commit d5fee3f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Orange/widgets/utils/concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,12 @@ def _on_task_done(self, future: Future):
self.on_exception(ex)
else:
self.on_done(future.result())
# This assert prevents user to start new task (call start) from either
# on_done or on_exception
assert self.__task is None, (
"Starting new task from "
f"{'on_done' if ex is None else 'on_exception'} is forbidden"
)


class ConcurrentWidgetMixin(ConcurrentMixin):
Expand Down

0 comments on commit d5fee3f

Please sign in to comment.