Skip to content

ZKanji hangs when importing examples #33

@mxmlnkn

Description

@mxmlnkn

Importing the dictionaries works OK except that 13 words from the JLPTN data file were not found in the imported dictionary and it asks me how to match them. But then, when importing examples, it just hangs after a very short while, no error window, no crash it, the window is still responsible and text can still be selected but the progress bar won't move.

Adding some debug output I could find out that it hangs on:

line 979 B: 真昼~ の 太陽 が テニスコート(#1080030) を 目(め) も 眩む~ 程{ほど} に 照らす{照らし} 上げる{あげた}

To be more exact it hangs after TextSearchTreeBase::findContainer throws an exception because the given length is 0 maybe because it couldn't find any romaji? In particular this parent call hangs: findKanjiKanaWord( "テニスコート" , "#1080030" , (nullptr) , 6 , 8 , -1 ).
I didn't look further what happens to this thrown exception and why no error dialog pops up. In the first place, it shouldn't throw. There must be some other underlying problem with the examples file. I think it happens because the #1080030 reference isn't ignored. In another run it hang on line 324 B: 此処{ここ} の ソース(#1075270)[01] は 舐める[02]{舐めて}~ 見る{みる} と 一寸(ちょっと){ちょっと} 塩っぱい, which is the first line containing such a hashtag number, so it might be that. I guess it it's sometimes this line and at others because it is multi-threaded?

I don't really know what I'm doing here but removing the hashtag number with sed makes it importable in ZKanji:

sed -i -r 's|\(#[0-9]+\)||g' examples.utf

P.S.: IMHO, you should avoid != expressions in for loops and instead almost always opt for > or <. Those != expressions are all just infinite loop bugs waiting to happen. Also, your code base is littered with trailing whitespaces, which my editor automatically removes and therefore leads to large diffs in git. I don't know if you'd accept merge requests but a kind of simple style check or uncrustify might be helpful for other contributors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions