Stvad / CrowdAnki

Plugin for Anki SRS designed to facilitate cooperation on creation of notes and decks.
MIT License
520 stars 44 forks source link

Prevent crash when trying to export all decks #129

Closed aplaice closed 3 years ago

aplaice commented 3 years ago

Fix #128.

The crash was caused by the warning dialog, itself! The issue was that export is now run in a background thread, but GUI operations from a background thread cause a crash.

AnkiModalNotifier is used in anki_exporter_wrapper.py and github_importer.py. The former is in a background thread, the latter in the main thread. In both cases, error messages are now correctly displayed, without crashing.

Tested on Anki 2.1.40 and 2.1.43.

For comparison / a similar issue see.

I'm not very happy about the solution — particularly the timer — but without the timer run_on_main results in some sort of weird deadlock and I can't think of a better method.

Stvad commented 3 years ago

hey, apologies for the delay getting back to this. have some big changes in life that I'm focusing on. should be able to review both your PR's now though!

aplaice commented 3 years ago

No problem! Good luck with the life changes! Thanks for your review here!