Bug 413720 - Parley crashes when I try to start practice with a certain file
Summary: Parley crashes when I try to start practice with a certain file
Status: RESOLVED FIXED
Alias: None
Product: parley
Classification: Applications
Component: general (show other bugs)
Version: 19.08.1
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: parley bug tracker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-01 20:20 UTC by Lukas Kirschner
Modified: 2022-10-30 08:24 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Corrupted Vocabulary file which can be opened in edit mode, but not in practice mode (38.32 KB, application/x-kvtml)
2019-11-01 20:20 UTC, Lukas Kirschner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Kirschner 2019-11-01 20:20:10 UTC
Created attachment 123651 [details]
Corrupted Vocabulary file which can be opened in edit mode, but not in practice mode

SUMMARY

Parley used to work fine for me until yesterday - The following steps seem to have corrupted my vocabulary file:
1. I entered practice mode and practiced both in "known -> learning" and "learning -> known" mode, using the attached vocabulary file.
2. I opened a downloaded vocabulary file from the file menu (File->Open Recent)
3. I practiced with the downloaded vocabulary file
4. I opened the other vocabulary file again
Now, my vocabulary file seems to be corrupted, because I cannot enter practice mode anymore without Parley crashing immediately. I can still open the file in editor mode, if I open the file from Dolphin.


STEPS TO REPRODUCE
1. Load the attached file into Parley
2. Start Practice Mode
--or--
1. Load the attached file from the Parley Dashboard (which opens the file in practice mode instead of editor mode)


OBSERVED RESULT
Parley crashes with a segfault (see attached backtrace)

EXPECTED RESULT
Parley opens the file in practice mode

SOFTWARE/OS VERSIONS
Arch Linux with i3wm and qt5ct

BACKTRACE:

Application: Parley (parley), signal: Segmentation fault
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f291e634fc0 (LWP 5755))]

Thread 5 (Thread 0x7f290ffff700 (LWP 5761)):
#0  0x00007f2927c9ef7a in pthread_cond_timedwait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007f29319535cc in QWaitCondition::wait(QMutex*, QDeadlineTimer) () from /usr/lib/libQt5Core.so.5
#2  0x00007f2931953719 in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQt5Core.so.5
#3  0x00007f2931950b9b in ?? () from /usr/lib/libQt5Core.so.5
#4  0x00007f293194d5b0 in ?? () from /usr/lib/libQt5Core.so.5
#5  0x00007f2927c984cf in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007f29315d92d3 in clone () from /usr/lib/libc.so.6

Thread 4 (Thread 0x7f2915678700 (LWP 5758)):
#0  0x00007f29315ce9ef in poll () from /usr/lib/libc.so.6
#1  0x00007f29274c1170 in ?? () from /usr/lib/libglib-2.0.so.0
#2  0x00007f29274c1241 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#3  0x00007f2931b73a1c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#4  0x00007f2931b1a4ec in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#5  0x00007f293194c385 in QThread::exec() () from /usr/lib/libQt5Core.so.5
#6  0x00007f2932adeb37 in ?? () from /usr/lib/libQt5DBus.so.5
#7  0x00007f293194d5b0 in ?? () from /usr/lib/libQt5Core.so.5
#8  0x00007f2927c984cf in start_thread () from /usr/lib/libpthread.so.0
#9  0x00007f29315d92d3 in clone () from /usr/lib/libc.so.6

Thread 3 (Thread 0x7f291722a700 (LWP 5757)):
#0  0x00007f2927c9ec45 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007f291784c50c in ?? () from /usr/lib/dri/i965_dri.so
#2  0x00007f291784c108 in ?? () from /usr/lib/dri/i965_dri.so
#3  0x00007f2927c984cf in start_thread () from /usr/lib/libpthread.so.0
#4  0x00007f29315d92d3 in clone () from /usr/lib/libc.so.6

Thread 2 (Thread 0x7f291d850700 (LWP 5756)):
#0  0x00007f29315ce9ef in poll () from /usr/lib/libc.so.6
#1  0x00007f29271e9630 in ?? () from /usr/lib/libxcb.so.1
#2  0x00007f29271eb2db in xcb_wait_for_event () from /usr/lib/libxcb.so.1
#3  0x00007f291e199101 in ?? () from /usr/lib/libQt5XcbQpa.so.5
#4  0x00007f293194d5b0 in ?? () from /usr/lib/libQt5Core.so.5
#5  0x00007f2927c984cf in start_thread () from /usr/lib/libpthread.so.0
#6  0x00007f29315d92d3 in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7f291e634fc0 (LWP 5755)):
[KCrash Handler]
#6  0x000055a1eeac2c2d in ?? ()
#7  0x000055a1eeac332f in ?? ()
#8  0x00007f2932771039 in QStyledItemDelegate::initStyleOption(QStyleOptionViewItem*, QModelIndex const&) const () from /usr/lib/libQt5Widgets.so.5
#9  0x00007f29327705f2 in QStyledItemDelegate::sizeHint(QStyleOptionViewItem const&, QModelIndex const&) const () from /usr/lib/libQt5Widgets.so.5
#10 0x00007f29327b96e3 in QTreeView::indexRowSizeHint(QModelIndex const&) const () from /usr/lib/libQt5Widgets.so.5
#11 0x00007f29327bae62 in QTreeViewPrivate::itemHeight(int) const () from /usr/lib/libQt5Widgets.so.5
#12 0x00007f29327bca8f in QTreeViewPrivate::updateScrollBars() () from /usr/lib/libQt5Widgets.so.5
#13 0x00007f29327c48c7 in QTreeView::updateGeometries() () from /usr/lib/libQt5Widgets.so.5
#14 0x00007f293274330e in QAbstractItemView::doItemsLayout() () from /usr/lib/libQt5Widgets.so.5
#15 0x00007f29327c2adb in QTreeView::doItemsLayout() () from /usr/lib/libQt5Widgets.so.5
#16 0x00007f29327bc456 in QTreeView::sizeHintForColumn(int) const () from /usr/lib/libQt5Widgets.so.5
#17 0x00007f293275c29d in ?? () from /usr/lib/libQt5Widgets.so.5
#18 0x00007f293275ca72 in QHeaderView::sectionSize(int) const () from /usr/lib/libQt5Widgets.so.5
#19 0x000055a1eeac107e in ?? ()
#20 0x000055a1eeac1af7 in ?? ()
#21 0x000055a1eea38aba in ?? ()
#22 0x000055a1eea3a7b1 in ?? ()
#23 0x000055a1ee9e1bfa in ?? ()
#24 0x000055a1eea5306d in ?? ()
#25 0x00007f2931b47a11 in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib/libQt5Core.so.5
#26 0x00007f29324ceeb3 in QAction::triggered(bool) () from /usr/lib/libQt5Widgets.so.5
#27 0x00007f29324d1644 in QAction::activate(QAction::ActionEvent) () from /usr/lib/libQt5Widgets.so.5
#28 0x00007f29325d031d in ?? () from /usr/lib/libQt5Widgets.so.5
#29 0x00007f29325d0546 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQt5Widgets.so.5
#30 0x00007f29326c5d6b in QToolButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib/libQt5Widgets.so.5
#31 0x00007f29325190e6 in QWidget::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#32 0x00007f29326c5e15 in QToolButton::event(QEvent*) () from /usr/lib/libQt5Widgets.so.5
#33 0x00007f29324d54f5 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#34 0x00007f29324def8a in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#35 0x00007f2931b1b9c2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#36 0x00007f29324de13b in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () from /usr/lib/libQt5Widgets.so.5
#37 0x00007f2932535391 in ?? () from /usr/lib/libQt5Widgets.so.5
#38 0x00007f29325382d4 in ?? () from /usr/lib/libQt5Widgets.so.5
#39 0x00007f29324d54f5 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#40 0x00007f29324dee11 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQt5Widgets.so.5
#41 0x00007f2931b1b9c2 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5
#42 0x00007f2931eb7bf4 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () from /usr/lib/libQt5Gui.so.5
#43 0x00007f2931eb949b in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /usr/lib/libQt5Gui.so.5
#44 0x00007f2931e93afc in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Gui.so.5
#45 0x00007f291e19a12c in ?? () from /usr/lib/libQt5XcbQpa.so.5
#46 0x00007f29274bf3ee in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#47 0x00007f29274c1201 in ?? () from /usr/lib/libglib-2.0.so.0
#48 0x00007f29274c1241 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#49 0x00007f2931b73a03 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#50 0x00007f2931b1a4ec in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQt5Core.so.5
#51 0x00007f2931b22326 in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5
#52 0x000055a1ee9dfec5 in ?? ()
#53 0x00007f2931501153 in __libc_start_main () from /usr/lib/libc.so.6
#54 0x000055a1ee9dff3e in ?? ()
[Inferior 1 (process 5755) detached]
Comment 1 Lukas Kirschner 2019-11-02 10:44:20 UTC
I was wrong. The bug does not occur with this certain file. To reproduce, do the following:
1. Load a vocabulary file with 5 languages into practice mode
2. Select the language with index 4 in the "learning language" combobox
3. Close Parley
4. Open Parley and load a vocabulary file with 2 languages from the Dashboard
Parley tries to load language no. 4, which crashes immediately with a segmentation fault (because there are only 2 languages).
The immediate location of the segfault is in statisticsmodel.cpp:122 where translation has the int value 4. This value seems to be loaded from the settings instead of the kvtml file, although the kvtml file has only two languages.
Comment 2 Lukas Kirschner 2019-11-02 11:34:27 UTC
I think the problem is that in statisticsmainwindow.cpp:61, initLanguages() is called *after* setDocument, but it needs to be called inside setDocument(). In initLanguages, the config is changed in case an invalid language index is detected, which needs to be done before the call of setModel().
Comment 3 Justin Zobel 2022-09-30 04:37:55 UTC
Thank you for reporting this crash in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the crash with a recent software version?

If you can reproduce the issue, please change the status to "CONFIRMED" when replying. Thank you!
Comment 4 Bug Janitor Service 2022-10-15 04:55:30 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Bug Janitor Service 2022-10-30 05:04:02 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!
Comment 6 Andreas Cord-Landwehr 2022-10-30 07:50:01 UTC
I am sorry, it seems that this bug slipped through triaging. I just had a look and can reproduce it with the described steps.
Thank your for the very detailed bug report and analysis!
Comment 7 Andreas Cord-Landwehr 2022-10-30 08:24:53 UTC
Git commit de1b5afc4976a0efa9dd3264330b49b9ff65caf6 by Andreas Cord-Landwehr.
Committed on 30/10/2022 at 08:13.
Pushed by cordlandwehr into branch 'master'.

Fix document update race conditions in model updates

The StatisticsModel requires both an updated KVocDocument and an updated
set of selected languages before being able to answer model request
correctly. This change ensures that for invalid combinations no
out-of-bounds access is performed.

M  +9    -0    src/statistics/statisticsmodel.cpp

https://invent.kde.org/education/parley/commit/de1b5afc4976a0efa9dd3264330b49b9ff65caf6