mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
make saveNow() consistently fire callback after returning to event loop
avoid gotchas with callback firing in the middle of a close event, etc
This commit is contained in:
parent
d330d2f77f
commit
b28ca8c0d1
1 changed files with 2 additions and 1 deletions
|
@ -283,7 +283,8 @@ class Editor:
|
||||||
def saveNow(self, callback):
|
def saveNow(self, callback):
|
||||||
"Save unsaved edits then call callback()."
|
"Save unsaved edits then call callback()."
|
||||||
if not self.note:
|
if not self.note:
|
||||||
callback()
|
# calling code may not expect the callback to fire immediately
|
||||||
|
self.mw.progress.timer(10, callback, False)
|
||||||
return
|
return
|
||||||
self.saveTags()
|
self.saveTags()
|
||||||
self.web.evalWithCallback("saveNow()", lambda res: callback())
|
self.web.evalWithCallback("saveNow()", lambda res: callback())
|
||||||
|
|
Loading…
Reference in a new issue