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

Mw.reset() update the deck label when it has been deleted #3190

Open
dae opened this issue May 6, 2024 · 0 comments
Open

Mw.reset() update the deck label when it has been deleted #3190

dae opened this issue May 6, 2024 · 0 comments

Comments

@dae
Copy link
Member

dae commented May 6, 2024

I developed a feature to execute a background task after sync. But it sometime pops up an error when user is closing the collection.
The error:
Anki 23.12.1 (1a1d4d5) (ao)
Python 3.9.15 Qt 6.5.3 PyQt 6.5.3
Platform: macOS-14.3.1-arm64-arm-64bit

Traceback (most recent call last):
File "aqt.taskman", line 142, in _on_closures_pending
File "aqt.taskman", line 86, in
File "/Users/jspear/Library/Application Support/Anki2/addons21/759844606/schedule/reschedule.py", line 171, in on_done
mw.reset()
File "aqt.main", line 851, in reset
File "aqt.main", line 803, in _synthesize_op_did_execute_from_reset
File "_aqt.hooks", line 3840, in call
File "aqt.deckchooser", line 120, in on_operation_did_execute
File "aqt.deckchooser", line 82, in _update_button_label
RuntimeError: wrapped C/C++ object of type QPushButton has been deleted

A quick and dirty fix would be to check for sip.isdeleted() here. DeckChooser has a cleanup() method that appears not to be called in this case. The inconsistent destruction/garbage collection of the C++ and Python side is a bit of a mess and mostly our fault, but I'm not sure it's worth spending a lot of effort trying to fix it, if a web/JS UI is the future.

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

No branches or pull requests

1 participant