Bug 332596 - crash when exiting unfinished practice
Summary: crash when exiting unfinished practice
Status: RESOLVED FIXED
Alias: None
Product: parley
Classification: Applications
Component: general (show other bugs)
Version: 0.9.4
Platform: Kubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: parley bug tracker
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-25 17:56 UTC by Ansa
Modified: 2014-07-23 17:39 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ansa 2014-03-25 17:56:36 UTC
This crash happens every time when the following conditions are met:
- I have started practice, but not finished it (i.e. I have revised not revised all words that are scheduled for practice),
- the file is not saved (i.e., the crash does not happen if I first wait 10 minutes, during which the file is autosaved - I do not know of any other way to save the vocabulary file from within the practice mode),
- I exit the practice mode by clicking "Stop Practice" in the menu bar.

Related information:
I am running Parley with a stylesheet, the content of which is just these four lines
QPushButton:focus {
 background-color:#C9DDF0;
 border:5px solid #C9DDF0;
}

The stylesheet and my vocabulary file are located on a USB disk, in the same directory. The vocabulary file is rather large, with some 6000 lines and many linked images and sound files. The number of words per practice is usually tens or maximum a few hundred words (today it was 66, and I reproduced the crash twice, once after answering a single word correctly and second time after not answering any words at all).

Reproducible: Always




Application: parley (0.9.4)
KDE Platform Version: 4.12.3
Qt Version: 4.8.2
Operating System: Linux 3.2.0-60-generic i686
Distribution: Ubuntu 12.04.4 LTS

-- Backtrace:
Application: Parley (parley), signal: Segmentation fault
Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0xb76d6740 (LWP 16169))]

Thread 2 (Thread 0xb335cb40 (LWP 16171)):
#0  0x008e6dcd in clock_gettime () from /lib/i386-linux-gnu/librt.so.1
#1  0x014ad3e5 in do_gettime (frac=0xb335bfb0, sec=0xb335bfa8) at tools/qelapsedtimer_unix.cpp:123
#2  qt_gettime () at tools/qelapsedtimer_unix.cpp:140
#3  0x01597726 in QTimerInfoList::updateCurrentTime (this=0xb5202074) at kernel/qeventdispatcher_unix.cpp:343
#4  0x01597a7a in QTimerInfoList::timerWait (this=0xb5202074, tm=...) at kernel/qeventdispatcher_unix.cpp:450
#5  0x01596323 in timerSourcePrepareHelper (src=<optimized out>, timeout=0xb335c0bc) at kernel/qeventdispatcher_glib.cpp:136
#6  0x015963bd in timerSourcePrepare (source=0xb5202040, timeout=<optimized out>) at kernel/qeventdispatcher_glib.cpp:169
#7  0x072ea832 in g_main_context_prepare () from /lib/i386-linux-gnu/libglib-2.0.so.0
#8  0x072eaf6f in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#9  0x072eb1c1 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#10 0x01596de7 in QEventDispatcherGlib::processEvents (this=0xb5200468, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#11 0x015626ad in QEventLoop::processEvents (this=0xb335c240, flags=...) at kernel/qeventloop.cpp:149
#12 0x01562949 in QEventLoop::exec (this=0xb335c240, flags=...) at kernel/qeventloop.cpp:204
#13 0x0144ba1c in QThread::exec (this=0x9903560) at thread/qthread.cpp:501
#14 0x0153fcfd in QInotifyFileSystemWatcherEngine::run (this=0x9903560) at io/qfilesystemwatcher_inotify.cpp:248
#15 0x0144eeb0 in QThreadPrivate::start (arg=0x9903560) at thread/qthread_unix.cpp:307
#16 0x008ced4c in start_thread () from /lib/i386-linux-gnu/libpthread.so.0
#17 0x01308bae in clone () from /lib/i386-linux-gnu/libc.so.6

Thread 1 (Thread 0xb76d6740 (LWP 16169)):
[KCrash Handler]
#7  0x00000000 in ?? ()
#8  0x02fa20b6 in QStyleSheetStyle::event (this=0xae73ed0, e=0xbfb789a0) at styles/qstylesheetstyle.cpp:5798
#9  0x02c28df4 in notify_helper (e=0xbfb789a0, receiver=0xae73ed0, this=0x986ec28) at kernel/qapplication.cpp:4556
#10 QApplicationPrivate::notify_helper (this=0x986ec28, receiver=0xae73ed0, e=0xbfb789a0) at kernel/qapplication.cpp:4528
#11 0x02c2e15d in QApplication::notify (this=0xbfb789a0, receiver=0xae73ed0, e=0xbfb789a0) at kernel/qapplication.cpp:4285
#12 0x03cc61e1 in KApplication::notify (this=0xbfb7a2e0, receiver=0xae73ed0, event=0xbfb789a0) at ../../kdeui/kernel/kapplication.cpp:311
#13 0x01563e0e in QCoreApplication::notifyInternal (this=0xbfb7a2e0, receiver=0xae73ed0, event=0xbfb789a0) at kernel/qcoreapplication.cpp:915
#14 0x02c2735c in sendEvent (event=0xbfb789a0, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#15 QApplicationPrivate::setFocusWidget (focus=0x0, reason=Qt::OtherFocusReason) at kernel/qapplication.cpp:2259
#16 0x02c713fc in clearFocus (this=0xa2f41f8) at kernel/qwidget.cpp:6542
#17 QWidget::clearFocus (this=0xa2f41f8) at kernel/qwidget.cpp:6526
#18 0x02c7cf19 in QWidget::~QWidget (this=0xa2f41f8, __in_chrg=<optimized out>) at kernel/qwidget.cpp:1608
#19 0x030aeacf in QLineEdit::~QLineEdit (this=0xa2f41f8, __in_chrg=<optimized out>) at widgets/qlineedit.cpp:357
#20 0x03d95c7f in KLineEdit::~KLineEdit (this=0xa2f41f8, __in_chrg=<optimized out>) at ../../kdeui/widgets/klineedit.cpp:245
#21 0x03d95d12 in KLineEdit::~KLineEdit (this=0xa2f41f8, __in_chrg=<optimized out>) at ../../kdeui/widgets/klineedit.cpp:248
#22 0x01579211 in QObjectPrivate::deleteChildren (this=0xa593fc8) at kernel/qobject.cpp:1908
#23 0x02c7cfcc in QWidget::~QWidget (this=0xa29cb88, __in_chrg=<optimized out>) at kernel/qwidget.cpp:1677
#24 0x080ab57d in ~AbstractModeWidget (this=0xa29cb88, __in_chrg=<optimized out>) at /home/ansa/Downloads/Zdroj/src/practice/abstractwidget.h:32
#25 ~WrittenPracticeWidget (this=0xa29cb88, __in_chrg=<optimized out>) at /home/ansa/Downloads/Zdroj/src/practice/writtenpracticewidget.h:28
#26 Practice::WrittenPracticeWidget::~WrittenPracticeWidget (this=0xa29cb88, __in_chrg=<optimized out>) at /home/ansa/Downloads/Zdroj/src/practice/writtenpracticewidget.h:28
#27 0x01579211 in QObjectPrivate::deleteChildren (this=0xadd5fa8) at kernel/qobject.cpp:1908
#28 0x02c7cfcc in QWidget::~QWidget (this=0xca9a2a0, __in_chrg=<optimized out>) at kernel/qwidget.cpp:1677
#29 0x02c7d2d2 in QWidget::~QWidget (this=0xca9a2a0, __in_chrg=<optimized out>) at kernel/qwidget.cpp:1701
#30 0x01579211 in QObjectPrivate::deleteChildren (this=0xaf247d0) at kernel/qobject.cpp:1908
#31 0x02c7cfcc in QWidget::~QWidget (this=0xb47e7c8, __in_chrg=<optimized out>) at kernel/qwidget.cpp:1677
#32 0x080b531b in ~ImageWidget (this=0xb47e7c8, __in_chrg=<optimized out>) at /home/ansa/Downloads/Zdroj/src/practice/imagewidget.h:24
#33 Practice::ImageWidget::~ImageWidget (this=0xb47e7c8, __in_chrg=<optimized out>) at /home/ansa/Downloads/Zdroj/src/practice/imagewidget.h:24
#34 0x080a6c8f in Practice::GuiFrontend::~GuiFrontend (this=0x9bca108, __in_chrg=<optimized out>) at /home/ansa/Downloads/Zdroj/src/practice/guifrontend.cpp:71
#35 0x080a6ce2 in Practice::GuiFrontend::~GuiFrontend (this=0x9bca108, __in_chrg=<optimized out>) at /home/ansa/Downloads/Zdroj/src/practice/guifrontend.cpp:72
#36 0x01579211 in QObjectPrivate::deleteChildren (this=0x9a1b588) at kernel/qobject.cpp:1908
#37 0x02c7cfcc in QWidget::~QWidget (this=0x9a051f0, __in_chrg=<optimized out>) at kernel/qwidget.cpp:1677
#38 0x030bc51f in QMainWindow::~QMainWindow (this=0x9a051f0, __in_chrg=<optimized out>) at widgets/qmainwindow.cpp:388
#39 0x03da1604 in KMainWindow::~KMainWindow (this=0x9a051f0, __in_chrg=<optimized out>) at ../../kdeui/widgets/kmainwindow.cpp:467
#40 0x03dec43c in KXmlGuiWindow::~KXmlGuiWindow (this=0x9a051f0, __vtt_parm=0x811d114, __in_chrg=<optimized out>) at ../../kdeui/xmlgui/kxmlguiwindow.cpp:118
#41 0x080b638c in Practice::PracticeMainWindow::~PracticeMainWindow (this=0x9a051f0, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /home/ansa/Downloads/Zdroj/src/practice/practicemainwindow.cpp:63
#42 0x080b6412 in Practice::PracticeMainWindow::~PracticeMainWindow (this=0x9a051f0, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /home/ansa/Downloads/Zdroj/src/practice/practicemainwindow.cpp:69
#43 0x08076a19 in ParleyMainWindow::switchComponent (this=0x9969490, component=ParleyMainWindow::PracticeSummary) at /home/ansa/Downloads/Zdroj/src/parleymainwindow.cpp:303
#44 0x08076ef9 in ParleyMainWindow::showPracticeSummary (this=0x9969490) at /home/ansa/Downloads/Zdroj/src/parleymainwindow.cpp:281
#45 0x0807781d in ParleyMainWindow::qt_metacall (this=0x9969490, _c=QMetaObject::InvokeMetaMethod, _id=11, _a=0xbfb79070) at /home/ansa/Downloads/Zdroj/build/src/parleymainwindow.moc:121
#46 0x0156b19d in metacall (argv=0xbfb79070, idx=57, cl=QMetaObject::InvokeMetaMethod, object=0x9969490) at kernel/qmetaobject.cpp:245
#47 QMetaObject::metacall (object=0x9969490, cl=QMetaObject::InvokeMetaMethod, idx=57, argv=0xbfb79070) at kernel/qmetaobject.cpp:240
#48 0x0157aebd in QMetaObject::activate (sender=0x9a051f0, m=0x811cda0, local_signal_index=1, argv=0x0) at kernel/qobject.cpp:3566
#49 0x080b6799 in Practice::PracticeMainWindow::stopPractice (this=0x9a051f0) at /home/ansa/Downloads/Zdroj/build/src/practicemainwindow.moc:100
#50 0x080b67ee in Practice::PracticeMainWindow::practiceFinished (this=0x9a051f0) at /home/ansa/Downloads/Zdroj/src/practice/practicemainwindow.cpp:170
#51 0x080b68a7 in Practice::PracticeMainWindow::qt_metacall (this=0x9a051f0, _c=QMetaObject::InvokeMetaMethod, _id=<optimized out>, _a=0xbfb791e0) at /home/ansa/Downloads/Zdroj/build/src/practicemainwindow.moc:83
#52 0x0156b19d in metacall (argv=0xbfb791e0, idx=49, cl=QMetaObject::InvokeMetaMethod, object=0x9a051f0) at kernel/qmetaobject.cpp:245
#53 QMetaObject::metacall (object=0x9a051f0, cl=QMetaObject::InvokeMetaMethod, idx=49, argv=0xbfb791e0) at kernel/qmetaobject.cpp:240
#54 0x0157aebd in QMetaObject::activate (sender=0xb893b60, m=0x8118b88, local_signal_index=0, argv=0x0) at kernel/qobject.cpp:3566
#55 0x0809fb39 in Practice::PracticeStateMachine::practiceFinished (this=0xb893b60) at /home/ansa/Downloads/Zdroj/build/src/practicestatemachine.moc:108
#56 0x0809fb8a in Practice::PracticeStateMachine::slotPracticeFinished (this=0xb893b60) at /home/ansa/Downloads/Zdroj/src/practice/practicestatemachine.cpp:130
#57 0x080a007b in Practice::PracticeStateMachine::qt_metacall (this=0xb893b60, _c=QMetaObject::InvokeMetaMethod, _id=<optimized out>, _a=0xbfb79398) at /home/ansa/Downloads/Zdroj/build/src/practicestatemachine.moc:90
#58 0x0156b19d in metacall (argv=0xbfb79398, idx=6, cl=QMetaObject::InvokeMetaMethod, object=0xb893b60) at kernel/qmetaobject.cpp:245
#59 QMetaObject::metacall (object=0xb893b60, cl=QMetaObject::InvokeMetaMethod, idx=6, argv=0xbfb79398) at kernel/qmetaobject.cpp:240
#60 0x0157aebd in QMetaObject::activate (sender=0xc5f8458, m=0x35a03f8, local_signal_index=1, argv=0xbfb79398) at kernel/qobject.cpp:3566
#61 0x02c2190d in QAction::triggered (this=0xc5f8458, _t1=false) at .moc/release-shared/moc_qaction.cpp:277
#62 0x02c21bab in QAction::activate (this=0xc5f8458, event=QAction::Trigger) at kernel/qaction.cpp:1257
#63 0x0312e9a0 in trigger (this=<optimized out>) at ../../include/QtGui/../../src/gui/kernel/qaction.h:218
#64 QToolButton::nextCheckState (this=0xcab07b0) at widgets/qtoolbutton.cpp:1144
#65 0x03056187 in QAbstractButtonPrivate::click (this=0xb13f620) at widgets/qabstractbutton.cpp:530
#66 0x03056486 in QAbstractButton::mouseReleaseEvent (this=0xcab07b0, e=0xbfb79a94) at widgets/qabstractbutton.cpp:1123
#67 0x0312ea3d in QToolButton::mouseReleaseEvent (this=0xcab07b0, e=0xbfb79a94) at widgets/qtoolbutton.cpp:718
#68 0x02c82ffc in QWidget::event (this=0xcab07b0, event=0xbfb79a94) at kernel/qwidget.cpp:8371
#69 0x03055729 in QAbstractButton::event (this=0xcab07b0, e=0xbfb79a94) at widgets/qabstractbutton.cpp:1082
#70 0x0313016c in QToolButton::event (this=0xcab07b0, event=0xbfb79a94) at widgets/qtoolbutton.cpp:1160
#71 0x02c28df4 in notify_helper (e=0xbfb79a94, receiver=0xcab07b0, this=0x986ec28) at kernel/qapplication.cpp:4556
#72 QApplicationPrivate::notify_helper (this=0x986ec28, receiver=0xcab07b0, e=0xbfb79a94) at kernel/qapplication.cpp:4528
#73 0x02c2ee74 in QApplication::notify (this=0x986ec28, receiver=0xcab07b0, e=0xbfb79a94) at kernel/qapplication.cpp:4099
#74 0x03cc61e1 in KApplication::notify (this=0xbfb7a2e0, receiver=0xcab07b0, event=0xbfb79a94) at ../../kdeui/kernel/kapplication.cpp:311
#75 0x01563e0e in QCoreApplication::notifyInternal (this=0xbfb7a2e0, receiver=0xcab07b0, event=0xbfb79a94) at kernel/qcoreapplication.cpp:915
#76 0x02c29db5 in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#77 QApplicationPrivate::sendMouseEvent (receiver=0xcab07b0, event=0xbfb79a94, alienWidget=0xcab07b0, nativeWidget=0x99c0928, buttonDown=0x35bdcf4, lastMouseReceiver=..., spontaneous=true) at kernel/qapplication.cpp:3167
#78 0x02cb5f94 in QETWidget::translateMouseEvent (this=0x99c0928, event=0xbfb79f4c) at kernel/qapplication_x11.cpp:4617
#79 0x02cb4b2d in QApplication::x11ProcessEvent (this=0xbfb7a2e0, event=0xbfb79f4c) at kernel/qapplication_x11.cpp:3732
#80 0x02ce1e1c in x11EventSourceDispatch (s=0x9863140, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#81 0x072ead46 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
#82 0x072eb0e5 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#83 0x072eb1c1 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#84 0x01596d87 in QEventDispatcherGlib::processEvents (this=0x983c858, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#85 0x02ce1a1a in QGuiEventDispatcherGlib::processEvents (this=0x983c858, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#86 0x015626ad in QEventLoop::processEvents (this=0xbfb7a244, flags=...) at kernel/qeventloop.cpp:149
#87 0x01562949 in QEventLoop::exec (this=0xbfb7a244, flags=...) at kernel/qeventloop.cpp:204
#88 0x0156834a in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1187
#89 0x02c269c4 in QApplication::exec () at kernel/qapplication.cpp:3817
#90 0x0806f96c in main (argc=<error reading variable: Cannot access memory at address 0x0>, argv=<error reading variable: Cannot access memory at address 0x4>) at /home/ansa/Downloads/Zdroj/src/main.cpp:139

The reporter indicates this bug may be a duplicate of or related to bug 271695.
Comment 1 Christoph Feck 2014-03-26 21:40:38 UTC
From looking at the backtrace, the custom style sheet causes the crash.
Comment 2 Ansa 2014-03-27 16:28:12 UTC
I forgot to mention it. It only happens with the stylesheet, so yes, it is the fact that I am using a stylesheet causing the crash. However, I do not see how the stylesheet itself could cause a crash - I have not been able to identify any error in the stylesheet (it is actually a qss stylesheet, the documentation may be found here http://qt-project.org/doc/qt-4.8/stylesheet-syntax.html ), so I still think this is a bug. I am beginning to suspect that this is not a parley bug though, but a Qt bug, as the option to use stylesheets is listed among "Qt specific options" (parley --help-qt).
Comment 3 Inge Wallin 2014-03-29 04:21:56 UTC
Hi Ansa,

I haven't used stylesheets before so I have a couple of question:
 - What do you call the file that contains the stylesheet?
 - Where do you put it?
 - Do you perform some action to turn it on/off or is the file enough?

Let's see if we can fix this crash.
Comment 4 Ansa 2014-03-29 15:08:50 UTC
You have to start parley with the stylesheet option, e.g. I start mine through

/usr/local/bin/parley --stylesheet /media/ansa/1D9D-9B1D/Jazyky_a_Parley/Parley/parley.qss

(i.e. I have the stylesheet on a flashdrive in the same directory as the kvtml files; I don't think the name or the location should matter)

When I start parley from the console, I get lots of output. It mentions some problem on the first few lines:

parley(5670) KEduVocDocument::KEduVocDocument: constructor done
parley(5670)/libkdegames KGameTheme::load: Attempting to load .desktop at "/usr/share/kde4/apps/parley/themes/theme_reference.desktop"
Could not add child element to parent element because the types are incorrect.
parley(5670) Practice::ImageCache::openCache: opened cache: "/home/ansa/.kde/share/apps/parley/startpagethemecache.bin"


However, the "Could not add child element" does not happen with the bees theme, and the crash happens with it, so it probably is not related. In both cases the "Last Opened Collections" list which appears right after starting parley does not have its usual colourful background when I start parley with the stylesheet, instead the background is white - definitely not an intended consequence of the stylesheet.
Comment 5 Ansa 2014-03-29 15:59:51 UTC
a minimum non-working example is an empty file used as a stylesheet

just create an empty file called parley.qss and run
/usr/bin/parley --stylesheet parley.qss

The welcome screen has white background as described above. Parley crashed when practice is exited prematurely.

With the original stylesheet, I noticed one more relevant thing: as the stylesheet highlights a button that is "in focus", and the crash only happens when no button is highlighted, i.e., only in written or mixed letter practice mode, and only when focus is on the input field.
Comment 6 Andreas 2014-07-04 20:17:15 UTC
Thank you Ansa, that was a well written and easy to replicate test case.

I have proposed a bugfix and posted it at:
https://git.reviewboard.kde.org/r/119119/
Comment 7 Andreas 2014-07-23 17:39:19 UTC
Git commit bea0ac4e413a4709e5e42c1ce5cc5baf79c1b3c7 by Andreas Xavier.
Committed on 06/07/2014 at 20:04.
Pushed by axavier into branch 'KDE/4.14'.

Fix crash when exiting unfinished written mode practice with style sheet

The bug was as follows.  When a WrittenPracticeWidget using a KLineEdit
styled with a qStyleSheet that has focus is deleted this triggers a
focus changing event, but the QStyleSheet returns a style that has
already been deleted and causes a crash when the invalid style is
applied.

The obvious solution of responding to the destroyed() event doesn't
work, because the destroyed() event happens after the crash.

In order to fix this bug, I transistion focus away from the KLineEdit
before the focus change preceding deletion.  The virtual function,
WrittenPracticeWidget::objectDestroyed,  avoids having a
practice mode switch statement as large as this comment
at each delete event.
REVIEW: 119119

M  +4    -0    src/practice/abstractwidget.cpp
M  +7    -0    src/practice/abstractwidget.h
M  +8    -0    src/practice/guifrontend.cpp
M  +7    -0    src/practice/guifrontend.h
M  +1    -1    src/practice/practicemainwindow.cpp
M  +29   -0    src/practice/writtenpracticewidget.cpp
M  +11   -0    src/practice/writtenpracticewidget.h

http://commits.kde.org/parley/bea0ac4e413a4709e5e42c1ce5cc5baf79c1b3c7
Comment 8 Andreas 2014-07-23 17:39:51 UTC
Git commit f382c4f9334e2beeabe25b35f3ea329f34b81072 by Andreas Xavier.
Committed on 06/07/2014 at 20:04.
Pushed by axavier into branch 'master'.

Fix crash when exiting unfinished written mode practice with style sheet

The bug was as follows.  When a WrittenPracticeWidget using a KLineEdit
styled with a qStyleSheet that has focus is deleted this triggers a
focus changing event, but the QStyleSheet returns a style that has
already been deleted and causes a crash when the invalid style is
applied.

The obvious solution of responding to the destroyed() event doesn't
work, because the destroyed() event happens after the crash.

In order to fix this bug, I transistion focus away from the KLineEdit
before the focus change preceding deletion.  The virtual function,
WrittenPracticeWidget::objectDestroyed,  avoids having a
practice mode switch statement as large as this comment
at each delete event.
REVIEW: 119119

M  +4    -0    src/practice/abstractwidget.cpp
M  +7    -0    src/practice/abstractwidget.h
M  +8    -0    src/practice/guifrontend.cpp
M  +7    -0    src/practice/guifrontend.h
M  +1    -1    src/practice/practicemainwindow.cpp
M  +29   -0    src/practice/writtenpracticewidget.cpp
M  +11   -0    src/practice/writtenpracticewidget.h

http://commits.kde.org/parley/f382c4f9334e2beeabe25b35f3ea329f34b81072