mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Make editor.cleanup() idempotent
Hammering the esc key as a dialog loads can cause it to be run more than once, leading to an error message.
This commit is contained in:
parent
496e074f29
commit
e50d40cedf
1 changed files with 3 additions and 2 deletions
|
@ -627,8 +627,9 @@ require("anki/ui").loaded.then(() => require("anki/NoteEditor").instances[0].too
|
|||
def cleanup(self) -> None:
|
||||
self.set_note(None)
|
||||
# prevent any remaining evalWithCallback() events from firing after C++ object deleted
|
||||
self.web.cleanup()
|
||||
self.web = None
|
||||
if self.web:
|
||||
self.web.cleanup()
|
||||
self.web = None
|
||||
|
||||
# legacy
|
||||
|
||||
|
|
Loading…
Reference in a new issue