mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
Revert "Ignore TaskManager's on_done callback if collection unloaded (#4076)"
This reverts commit ccc42227d8
.
Closes #4094
This commit is contained in:
parent
c5eb00cb42
commit
a63e4ef1c8
1 changed files with 1 additions and 8 deletions
|
@ -84,15 +84,8 @@ class TaskManager(QObject):
|
|||
fut = executor.submit(task, **args)
|
||||
|
||||
if on_done is not None:
|
||||
|
||||
def wrapped_done(future: Future) -> None:
|
||||
if uses_collection and not (self.mw.col and self.mw.col.db):
|
||||
print(f"Ignored on_done as collection unloaded: {repr(on_done)}")
|
||||
return
|
||||
on_done(future)
|
||||
|
||||
fut.add_done_callback(
|
||||
lambda future: self.run_on_main(lambda: wrapped_done(future))
|
||||
lambda future: self.run_on_main(lambda: on_done(future))
|
||||
)
|
||||
|
||||
return fut
|
||||
|
|
Loading…
Reference in a new issue