z1dev / zkanji

Japanese language study suite and dictionary
GNU General Public License v3.0
59 stars 10 forks source link

Segmentation fault when trying to play Kanji stroke order #34

Closed mxmlnkn closed 3 years ago

mxmlnkn commented 4 years ago

Open zkanji v0.1.0 eacaa02. Double click on any kanji in the list which is shown by default. Press on the play button.

Screenshot from 2020-05-01 22-41-06

Backtrace:

[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff1b84700 (LWP 31180)]
[New Thread 0x7fffeb8db700 (LWP 31181)]
[New Thread 0x7fffeb0da700 (LWP 31182)]
[New Thread 0x7fffea44e700 (LWP 31188)]

Thread 1 "zkanji" received signal SIGSEGV, Segmentation fault.
0x00005555556e08ae in KanjiElementList::strokeCount(int, int) const ()
(gdb) bt
#0  0x00005555556e08ae in KanjiElementList::strokeCount(int, int) const ()
#1  0x00005555558480af in ZKanjiDiagram::play() ()
#2  0x00005555558f8101 in KanjiInfoForm::qt_metacall(QMetaObject::Call, int, void**) ()
#3  0x00007ffff5d734f7 in void doActivate<false>(QObject*, int, void**) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Core.so.5
#4  0x00007ffff7395192 in QAbstractButton::clicked(bool) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Widgets.so.5
#5  0x00007ffff7395394 in QAbstractButtonPrivate::emitClicked() () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Widgets.so.5
#6  0x00007ffff7396f2f in QAbstractButtonPrivate::click() () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Widgets.so.5
#7  0x00007ffff7397095 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Widgets.so.5
#8  0x00007ffff747844a in QToolButton::mouseReleaseEvent(QMouseEvent*) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Widgets.so.5
#9  0x00007ffff72e8728 in QWidget::event(QEvent*) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Widgets.so.5
#10 0x00007ffff7478519 in QToolButton::event(QEvent*) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Widgets.so.5
#11 0x00007ffff72a9a7c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Widgets.so.5
#12 0x00007ffff72b1208 in QApplication::notify(QObject*, QEvent*) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Widgets.so.5
#13 0x00005555558cf8cd in ZApplication::notify(QObject*, QEvent*) ()
#14 0x00007ffff5d3cae8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Core.so.5
#15 0x00007ffff72b01fa in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool)
    () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Widgets.so.5
#16 0x00007ffff7301e41 in QWidgetWindow::handleMouseEvent(QMouseEvent*) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Widgets.so.5
#17 0x00007ffff7304a8b in QWidgetWindow::event(QEvent*) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Widgets.so.5
#18 0x00007ffff72a9a7c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Widgets.so.5
#19 0x00007ffff72b0cb0 in QApplication::notify(QObject*, QEvent*) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Widgets.so.5
#20 0x00005555558cf8cd in ZApplication::notify(QObject*, QEvent*) ()
#21 0x00007ffff5d3cae8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Core.so.5
#22 0x00007ffff6797ad8 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) ()
    at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Gui.so.5
#23 0x00007ffff6798fb5 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) ()
    at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Gui.so.5
#24 0x00007ffff6775bdb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Gui.so.5
#25 0x00007ffff22f1e7a in xcbSourceDispatch(_GSource*, int (*)(void*), void*) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5XcbQpa.so.5
#26 0x00007ffff30fd8bd in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#27 0x00007ffff30fdb40 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007ffff30fdbe3 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007ffff5d9555c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Core.so.5
#30 0x00007ffff5d3b502 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Core.so.5
#31 0x00007ffff5d44430 in QCoreApplication::exec() () at /opt/Qt5.14.0/5.14.0/gcc_64/lib/libQt5Core.so.5
#32 0x00005555555feba0 in main ()

It looks like KanjiElementList::strokeCount is given -1 for some reason and list.size() == 0 and you are using that externally given index to access an internal vector without any checks resulting in this segfault.

z1dev commented 3 years ago

Hi! Sorry for not writing before, but GitHub forgot to notify me of issues posted here apparently for a while now. I haven't seen multiple issues until now.

I'm not working on this project anymore. I wanted to make a full release and maybe add some small adjustments years ago, but for a long time nobody tested zkanji or reported issues, and I didn't want to make a full release of a possibly buggy program, then I moved on. (I'm adding this text at the start of every answer today, it's not a sign I don't care.)

I don't have this issue, so I'm not sure what's causing it for you. Do you have the stroke order file present in your data folder? (zdict.zks) Zkanji should check for its presence and not start without it, or disable the controls, I don't remember now.

mxmlnkn commented 3 years ago

I feel your pain. I still have the same issue with issues being opened on my projects. Github does not notify me when new issues are opened even when I'm watching or even owning that repo. It only notifies me when I watch that issue or I think even if someone else posts an answer in that issue? Might be worth opening an issue at github.

I don't have any zdict.zks file in the data folder. I guess that is the issue. Maybe I forgot this or the installation instructions are incomplete or out of data.

I'm not working on this project anymore. I wanted to make a full release and maybe add some small adjustments years ago, but for a long time nobody tested zkanji or reported issues, and I didn't want to make a full release of a possibly buggy program, then I moved on. (I'm adding this text at the start of every answer today, it's not a sign I don't care.)

That's too bad. Weird to ask, but do you have an alternative or do you not need ZKanji anymore for your own usage anymore? I'm still using it from time to time but well, it works sufficiently enough with wine on Linux for my usages.

z1dev commented 3 years ago

do you have an alternative or do you not need ZKanji anymore for your own usage anymore?

I sometimes check to see if anyone works on a similar project but I don't see any good alternative, even if this sounds the opposite of humble. To answer, it's partially that I don't need it anymore. I got to a level where I understand a lot of conversational Japanese and that was my main goal. I still can't actively speak, but I don't have the opportunity and am not that social anyway. I still use the kanji lookup sometimes but that's about it.

I wish someone could take over the project so it doesn't go to waste, and I would be there to help them understand the code, but I don't see myself actively developing now. This version can be compiled for Linux, and then you wouldn't need wine, but I have no experience on Linux distribution so I only provided instructions on how to build it on the main page here on GitHub.

z1dev commented 3 years ago

Just a heads up, I'll close this report later today or tomorrow.