Vilhelm-Ian / anki-search-inside-add-card

An add-on providing full-text-search and PDF reading functionality to Anki's Add card dialog
https://ankiweb.net/shared/info/1781298089
GNU Affero General Public License v3.0
11 stars 3 forks source link

Crashes when not a pdf is opened and adding multiple items #1

Open Vilhelm-Ian opened 10 months ago

Vilhelm-Ian commented 10 months ago

The error I get is 'anki' terminated by signal SIGTRAP (Trace or breakpoint trap)

it happens after creating multiple notes and no pdf is opened. The number of new cards required for it to happen is variable.

Vilhelm-Ian commented 10 months ago

I was able to triage the problem it is related with "search on typing" option

Vilhelm-Ian commented 10 months ago

it also crashes when you check "search on typing" and dosen't crash when you uncheck "search on typing"

checking "search typing" calls this function

SIAC.State.searchOnSelection = $(this).is(":checked"); sendSearchOnSelection();

but calling it dircetly from the browser does nothing

Vilhelm-Ian commented 10 months ago

executing this command {showLoading('Searchbar'),html=byId('siac-browser-search-inp').value+'\x1F',pycmd('siac-r-srch-db '+SIAC.State.selectedDecks.toString()+' ~ '+html)}

crashes anki

specifically this part pycmd('siac-r-srch-db '+SIAC.State.selectedDecks.toString()+' ~ '+html)

Vilhelm-Ian commented 10 months ago

the problem appears when a user searches for something but the search is empty. if len(content) < 1: UI.empty_result("No results found for empty string")

    this part of the code is executede
Vilhelm-Ian commented 10 months ago
    # cls._editor.web.eval("setSearchResults(null, '', `%s`, null, 1, 1, 50, %s)" % (message, len(cls.previous_calls) + 1))

commenting this line out prevents itfrom crashing

Vilhelm-Ian commented 10 months ago

I figured out whatthe problem is ~~setSearchResults(null, '', %s, null, 1, 1, 50, %s)" % (message, len(cls.previous_calls) + 1

the second %s is missing ` `~~

nope it's not that. for some reason any code that you run with web.eval makes it crash. I have no idea why cls._editor.web.eval("console.log('hi');")

Vilhelm-Ian commented 10 months ago

~~I found out what was the issue.
dosen't have the eval metho cls._editor.web~~

nope that's not the issue

Vilhelm-Ian commented 9 months ago

Someone on ankiweb mentioned that the issue is probably caused because the addon is trying to envoke qt code from a background thread