Crash when sending data to an existing note + a temporary fix
-
The
editor.loadNote()
call near the end of the_handle_data_from_card_creator
function inmigaku_connection/card_creator.py
causes a complete crash that only printsTrace/breakpoint trap (core dumped)
.Looking into the
editor.loadNote()
function it seems to generate some JS code to refresh the editor webview. I initially thought this JS code might be getting messed up somehow, so I inserted some log statements into it using theeditor_will_load_note
hook. However, the crash seems to happen before the JS code is evaluated. The JS code is successfully generated and evaluated when opening the editor and selecting a note. The crash only occurs during the Migaku addon'seditor.loadNote()
call, even after I modified the addon code so that the JS code would be identical.What it is precisely that happens between the
editor_will_load_note
hook and the JS code being evaluated, and in what way it is different when the addon calls theeditor.loadNote()
is a bit too much for me to figure out right now.As a temporary solution I simply replaced the section marked with
# TODO: Refactor
with a simple call toaqt.mw.col.update_note(note)
. This saves the data (as long as the target field is not currently in focus) and prevents the crash, but does not update the UI.I am on Anki version 2.1.63 and Addon version 0.2.5