Bug 238022

Summary: Parley crashed on export to html
Product: [Applications] parley Reporter: GreyShaman <greyshaman>
Component: generalAssignee: parley bug tracker <parley-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: mail
Priority: NOR    
Version: 0.9.3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 4.11.3
Sentry Crash Report:

Description GreyShaman 2010-05-18 11:30:07 UTC
Application: parley (0.9.3)
KDE Platform Version: 4.4.2 (KDE 4.4.2)
Qt Version: 4.6.2
Operating System: Linux 2.6.32-22-generic x86_64
Distribution: Ubuntu 10.04 LTS

-- Information about the crash:
When I attempt to export dictionary to HTML parley is crashed. I have two lesson and select last one when export to html.

The crash can be reproduced every time.

 -- Backtrace:
Application: Parley (parley), signal: Segmentation fault
[KCrash Handler]
#5  _IO_new_fclose (fp=0x0) at iofclose.c:57
#6  0x00000000004cd2ad in ExportDialog::accept (this=<value optimized out>) at ../../../parley/src/export/exportdialog.cpp:92
#7  0x00007f19527404c5 in KDialog::slotButtonClicked (this=0x7fff226cdbc0, button=4) at ../../kdeui/dialogs/kdialog.cpp:863
#8  0x00007f1952742329 in KDialog::qt_metacall (this=0x7fff226cdbc0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff226cc420) at ./kdialog.moc:190
#9  0x00000000004cca58 in ExportDialog::qt_metacall (this=0x0, _c=32072960, _id=31590096, _a=0x141f0) at ./exportdialog.moc:67
#10 0x00007f19537bce3f in QMetaObject::activate (sender=0x1d0a668, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x141f0) at kernel/qobject.cpp:3293
#11 0x00007f19537c215e in QSignalMapper::mapped (this=0x0, _t1=4) at .moc/release-shared/moc_qsignalmapper.cpp:101
#12 0x00007f19537c3372 in QSignalMapper::map (this=0x1d0a668, sender=0x1d0a690) at kernel/qsignalmapper.cpp:266
#13 0x00007f19537c35f0 in QSignalMapper::qt_metacall (this=0x1d0a668, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff226cc5b0) at .moc/release-shared/moc_qsignalmapper.cpp:87
#14 0x00007f19537bce3f in QMetaObject::activate (sender=0x1d0a690, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x141f0) at kernel/qobject.cpp:3293
#15 0x00007f1951a465f2 in QAbstractButton::clicked (this=0x0, _t1=false) at .moc/release-shared/moc_qabstractbutton.cpp:206
#16 0x00007f195176086b in QAbstractButtonPrivate::emitClicked (this=0x1bfa060) at widgets/qabstractbutton.cpp:546
#17 0x00007f195176170b in QAbstractButtonPrivate::click (this=0x1bfa060) at widgets/qabstractbutton.cpp:539
#18 0x00007f195176197c in QAbstractButton::mouseReleaseEvent (this=0x1d0a690, e=0x7fff226ccf00) at widgets/qabstractbutton.cpp:1121
#19 0x00007f1951401582 in QWidget::event (this=0x1d0a690, event=0x7fff226ccf00) at kernel/qwidget.cpp:7998
#20 0x00007f19513ab22c in QApplicationPrivate::notify_helper (this=0xa45f60, receiver=0x1d0a690, e=0x7fff226ccf00) at kernel/qapplication.cpp:4300
#21 0x00007f19513b1ecb in QApplication::notify (this=0x7fff226cf6c0, receiver=0x1d0a690, e=0x7fff226ccf00) at kernel/qapplication.cpp:3865
#22 0x00007f19527d0526 in KApplication::notify (this=0x7fff226cf6c0, receiver=0x1d0a690, event=0x7fff226ccf00) at ../../kdeui/kernel/kapplication.cpp:302
#23 0x00007f19537aa06c in QCoreApplication::notifyInternal (this=0x7fff226cf6c0, receiver=0x1d0a690, event=0x7fff226ccf00) at kernel/qcoreapplication.cpp:704
#24 0x00007f19513b10ae in QCoreApplication::sendEvent (receiver=0x1d0a690, event=0x7fff226ccf00, alienWidget=0x1d0a690, nativeWidget=0x7fff226cdbc0, buttonDown=<value optimized out>, 
    lastMouseReceiver=<value optimized out>, spontaneous=true) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#25 QApplicationPrivate::sendMouseEvent (receiver=0x1d0a690, event=0x7fff226ccf00, alienWidget=0x1d0a690, nativeWidget=0x7fff226cdbc0, buttonDown=<value optimized out>, 
    lastMouseReceiver=<value optimized out>, spontaneous=true) at kernel/qapplication.cpp:2965
#26 0x00007f1951430f65 in QETWidget::translateMouseEvent (this=0x7fff226cdbc0, event=<value optimized out>) at kernel/qapplication_x11.cpp:4368
#27 0x00007f195142f8ac in QApplication::x11ProcessEvent (this=<value optimized out>, event=0x7fff226cd820) at kernel/qapplication_x11.cpp:3501
#28 0x00007f195145b882 in x11EventSourceDispatch (s=0xa49cf0, callback=<value optimized out>, user_data=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:146
#29 0x00007f194d6e08c2 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#30 0x00007f194d6e4748 in ?? () from /lib/libglib-2.0.so.0
#31 0x00007f194d6e48fc in g_main_context_iteration () from /lib/libglib-2.0.so.0
#32 0x00007f19537d3513 in QEventDispatcherGlib::processEvents (this=0xa29380, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:412
#33 0x00007f195145b46e in QGuiEventDispatcherGlib::processEvents (this=0x0, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:204
#34 0x00007f19537a8992 in QEventLoop::processEvents (this=<value optimized out>, flags=) at kernel/qeventloop.cpp:149
#35 0x00007f19537a8d6c in QEventLoop::exec (this=0x7fff226cdb50, flags=) at kernel/qeventloop.cpp:201
#36 0x00007f195187509e in QDialog::exec (this=0x7fff226cdbc0) at dialogs/qdialog.cpp:546
#37 0x00000000004d0bcc in ParleyDocument::exportDialog (this=0xad6b20) at ../../../parley/src/parleydocument.cpp:429
#38 0x00000000004d435c in ParleyDocument::qt_metacall (this=0xad6b20, _c=QMetaObject::InvokeMetaMethod, _id=31590096, _a=0x7fff226cdd70) at ./parleydocument.moc:108
#39 0x00007f19537bce3f in QMetaObject::activate (sender=0x1b901b0, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x141f0) at kernel/qobject.cpp:3293
#40 0x00007f19513a5032 in QAction::triggered (this=0x0, _t1=false) at .moc/release-shared/moc_qaction.cpp:263
#41 0x00007f19513a70ab in QAction::activate (this=0x1b901b0, event=<value optimized out>) at kernel/qaction.cpp:1255
#42 0x00007f19517e639d in QMenuPrivate::activateCausedStack (this=<value optimized out>, causedStack=..., action=0x1b901b0, action_e=QAction::Trigger, self=true) at widgets/qmenu.cpp:1011
#43 0x00007f19517ebdda in QMenuPrivate::activateAction (this=0x1bbc8c0, action=0x1b901b0, action_e=QAction::Trigger, self=<value optimized out>) at widgets/qmenu.cpp:1103
#44 0x00007f19528accee in KMenu::mouseReleaseEvent (this=0x1bbb5a0, e=0x1e96500) at ../../kdeui/widgets/kmenu.cpp:471
#45 0x00007f1951401582 in QWidget::event (this=0x1bbb5a0, event=0x7fff226ce9c0) at kernel/qwidget.cpp:7998
#46 0x00007f19517edf9b in QMenu::event (this=0x1bbb5a0, e=0x7fff226ce9c0) at widgets/qmenu.cpp:2414
#47 0x00007f19513ab22c in QApplicationPrivate::notify_helper (this=0xa45f60, receiver=0x1bbb5a0, e=0x7fff226ce9c0) at kernel/qapplication.cpp:4300
#48 0x00007f19513b1ecb in QApplication::notify (this=0x7fff226cf6c0, receiver=0x1bbb5a0, e=0x7fff226ce9c0) at kernel/qapplication.cpp:3865
#49 0x00007f19527d0526 in KApplication::notify (this=0x7fff226cf6c0, receiver=0x1bbb5a0, event=0x7fff226ce9c0) at ../../kdeui/kernel/kapplication.cpp:302
#50 0x00007f19537aa06c in QCoreApplication::notifyInternal (this=0x7fff226cf6c0, receiver=0x1bbb5a0, event=0x7fff226ce9c0) at kernel/qcoreapplication.cpp:704
#51 0x00007f19513b10ae in QCoreApplication::sendEvent (receiver=0x1bbb5a0, event=0x7fff226ce9c0, alienWidget=0x0, nativeWidget=0x1bbb5a0, buttonDown=<value optimized out>, 
    lastMouseReceiver=<value optimized out>, spontaneous=true) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#52 QApplicationPrivate::sendMouseEvent (receiver=0x1bbb5a0, event=0x7fff226ce9c0, alienWidget=0x0, nativeWidget=0x1bbb5a0, buttonDown=<value optimized out>, lastMouseReceiver=<value optimized out>, 
    spontaneous=true) at kernel/qapplication.cpp:2965
#53 0x00007f19514313dd in QETWidget::translateMouseEvent (this=0x1bbb5a0, event=<value optimized out>) at kernel/qapplication_x11.cpp:4302
#54 0x00007f195142f8ac in QApplication::x11ProcessEvent (this=<value optimized out>, event=0x7fff226cf2e0) at kernel/qapplication_x11.cpp:3501
#55 0x00007f195145b882 in x11EventSourceDispatch (s=0xa49cf0, callback=<value optimized out>, user_data=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:146
#56 0x00007f194d6e08c2 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#57 0x00007f194d6e4748 in ?? () from /lib/libglib-2.0.so.0
#58 0x00007f194d6e48fc in g_main_context_iteration () from /lib/libglib-2.0.so.0
#59 0x00007f19537d3513 in QEventDispatcherGlib::processEvents (this=0xa29380, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:412
#60 0x00007f195145b46e in QGuiEventDispatcherGlib::processEvents (this=0x0, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:204
#61 0x00007f19537a8992 in QEventLoop::processEvents (this=<value optimized out>, flags=) at kernel/qeventloop.cpp:149
#62 0x00007f19537a8d6c in QEventLoop::exec (this=0x7fff226cf610, flags=) at kernel/qeventloop.cpp:201
#63 0x00007f19537acaab in QCoreApplication::exec () at kernel/qcoreapplication.cpp:981
#64 0x00000000004d7cc2 in main (argc=<value optimized out>, argv=<value optimized out>) at ../../../parley/src/main.cpp:139

Reported using DrKonqi
Comment 1 Sven Wehner 2011-02-02 23:43:45 UTC
I have the same problem with parley version 0.9.4 (KDE 4.5.5), when I try to export to a file like "/home/xxx/日本語/test.html".
The interesting part is, that "/home/xxx/日本語/test.html" doesn't work, but "/home/xxx/日本語.html" works, I just get an "???.html" file. Thus, I guess the problem is the "invalid" folder (since there seems to be a conversion to "/home/xxx/???/", which doesn't exist).

You can see the problem in the file "src/export/exportdialog.cpp" in lines 89-91:
-- snip --
    FILE* result = fopen( (const char*) filename.toLocalFile().toLatin1(), "w");
    xsltSaveResultToFile(result, res, cur);
    fclose(result);
-- snap --
(Note: the relevant part still exists in the KDE 4.6 release and trunk; the websvn version is the latest version, isn't it?)

As you can see, the main problem is that there are no error checks at all. I guess it would be best to add a test whether fopen() succeeded (check FILE* result for NULL, fclose(NULL) segfaults!), and to check the return value of xsltSaveResultToFile() (it returns the number of written bytes, -1 in case of an error). In the latter case one could open a warning message.


Does anybody know, if this is a general KUrl related problem?
Comment 2 José Manuel Santamaría Lema 2013-10-29 10:19:32 UTC
Git commit f44b055cf894742aab8c138121d6da810bb6cd8d by José Manuel Santamaría Lema.
Committed on 29/10/2013 at 10:15.
Pushed by joselema into branch 'KDE/4.11'.

Check if the file is writable when exporting to HTML.

Without this change the program would crash if you couldn't write to the
specified file (for instance when you don't have write permissions in the path
in question).

REVIEW: 113490

M  +7    -2    src/export/exportdialog.cpp

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