Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent crash when trying to export all decks #129

Merged
merged 2 commits into from
Jun 4, 2021

Conversation

aplaice
Copy link
Collaborator

@aplaice aplaice commented Apr 27, 2021

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.

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.
crowd_anki/utils/notifier.py Outdated Show resolved Hide resolved
@Stvad
Copy link
Owner

Stvad commented Jun 4, 2021

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!

The attempted run times (in ms) will be (0, 100, 200, 300).  A timeout
of 0 does not seem to be used anywhere in the main Anki codebase, but
is valid: https://doc.qt.io/qt-5/qtimer.html#details
@aplaice
Copy link
Collaborator Author

aplaice commented Jun 4, 2021

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

@Stvad Stvad merged commit b25eace into Stvad:master Jun 4, 2021
@aplaice aplaice deleted the crashing_export_all_decks branch June 5, 2021 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trying to export all decks crashes Anki
2 participants