Crash when sending data to an existing note + a temporary fix
editor.loadNote()call near the end of the
migaku_connection/card_creator.pycauses a complete crash that only prints
Trace/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 the
editor_will_load_notehook. 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's
editor.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_notehook and the JS code being evaluated, and in what way it is different when the addon calls the
editor.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: Refactorwith a simple call to
aqt.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