Summary: | crash when doing ctrl-a ctrl-c on a smallish document (Section vs SectionEnd-mismatch) | ||
---|---|---|---|
Product: | [Applications] calligrawords | Reporter: | Jos van den Oever <jos> |
Component: | general | Assignee: | Halla Rempt <halla> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | elvstone, mail |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Unlisted Binaries | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
file that crashes
Minimal example .odt that provokes this crash |
I can reproduce. Or wait, I actually get a different crash on this document when doing ctrl+a and the ctrl+c. It's related to sections. Discussing it a little with Casper now. Looks as following backtrace Indicates a mismatch between writer->startElement("text:section", false); vs writer->endElement(); calls. The section-code calls endElement() at least one time to much... Assigning to Boudwijn cause afaik it's his code and he probably knows why it's wrong :) Application: Words (words), signal: Aborted [KCrash Handler] #6 0x00007fa435bedab5 in raise () from /lib64/libc.so.6 #7 0x00007fa435beefb6 in abort () from /lib64/libc.so.6 #8 0x00007fa43694bef8 in qt_message_output (msgType=QtFatalMsg, buf=0xfcbe58 "ASSERT: \"!this->isEmpty()\" in file /home/kde4/qt/include/QtCore/qstack.h, line 67") at /home/kde4/svn/qt/src/corelib/global/qglobal.cpp:2259 #9 0x00007fa43694c074 in qt_message(QtMsgType, const char *, typedef __va_list_tag __va_list_tag *) (msgType=QtFatalMsg, msg=0x7fa436af47f0 "ASSERT: \"%s\" in file %s, line %d", ap=0x7ffff022eaf0) at /home/kde4/svn/qt/src/corelib/global/qglobal.cpp:2305 #10 0x00007fa43694c8e2 in qFatal (msg=0x7fa436af47f0 "ASSERT: \"%s\" in file %s, line %d") at /home/kde4/svn/qt/src/corelib/global/qglobal.cpp:2488 #11 0x00007fa43694baab in qt_assert (assertion=0x7fa43b6a91be "!this->isEmpty()", file=0x7fa43b6a9198 "/home/kde4/qt/include/QtCore/qstack.h", line=67) at /home/kde4/svn/qt/src/corelib/global/qglobal.cpp:2004 #12 0x00007fa43b687b49 in QStack<KoXmlWriter::Tag>::pop (this=0x7263a8) at /home/kde4/qt/include/QtCore/qstack.h:67 #13 0x00007fa43b6865b1 in KoXmlWriter::endElement (this=0x1012b10) at /home/snoopy/src/calligra/libs/odf/KoXmlWriter.cpp:180 #14 0x00007fa43bce1a4c in KoSectionEnd::saveOdf (this=0xb05750, context=...) at /home/snoopy/src/calligra/libs/kotext/KoSection.cpp:121 #15 0x00007fa43bd6d892 in KoTextWriter::Private::writeBlocks (this=0x10823c0, document=0xb82770, from=0, to=717, listStyles=..., currentTable=0x0, currentFrame=0x0, currentList=0x0) at /home/snoopy/src/calligra/libs/kotext/opendocument/KoTextWriter.cpp:1735 #16 0x00007fa43bd7384c in KoTextWriter::write (this=0x7ffff022ef60, document=0xb82770, from=0, to=717) at /home/snoopy/src/calligra/libs/kotext/opendocument/KoTextWriter.cpp:2549 #17 0x00007fa43bcbff86 in KoTextOdfSaveHelper::writeBody (this=0x7ffff022f270) at /home/snoopy/src/calligra/libs/kotext/KoTextOdfSaveHelper.cpp:72 #18 0x00007fa43bd81102 in KoTextDrag::setOdf (this=0x7ffff022f260, mimeType=0x7fa43b6a2b48 "application/vnd.oasis.opendocument.text", helper=...) at /home/snoopy/src/calligra/libs/kotext/KoTextDrag.cpp:109 #19 0x00007fa4229a37bc in TextTool::copy (this=0xd8ef40) at /home/snoopy/src/calligra/plugins/textshape/TextTool.cpp:792 #20 0x00007fa43b9a0797 in KoToolProxy::copy (this=0xd63520) at /home/snoopy/src/calligra/libs/flake/KoToolProxy.cpp:450 #21 0x00007fa43b931827 in KoCopyControllerPrivate::copy (this=0x1032ff0) at /home/snoopy/src/calligra/libs/flake/KoCopyController.cpp:62 #22 0x00007fa43b931c60 in KoCopyController::qt_metacall (this=0x10344c0, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0x7ffff022f4d0) at /home/kde4/svn/build/calligra/libs/flake/KoCopyController.moc:82 #23 0x00007fa436a7c28f in QMetaObject::metacall (object=0x10344c0, cl=QMetaObject::InvokeMetaMethod, idx=6, argv=0x7ffff022f4d0) at /home/kde4/svn/qt/src/corelib/kernel/qmetaobject.cpp:237 #24 0x00007fa436a910c5 in QMetaObject::activate (sender=0x103d5d0, m=0x7fa438b45d40, local_signal_index=1, argv=0x7ffff022f4d0) at /home/kde4/svn/qt/src/corelib/kernel/qobject.cpp:3272 #25 0x00007fa437ded5f2 in QAction::triggered (this=0x103d5d0, _t1=false) at .moc/debug-shared/moc_qaction.cpp:263 #26 0x00007fa437dec8f4 in QAction::activate (this=0x103d5d0, event=QAction::Trigger) at /home/kde4/svn/qt/src/gui/kernel/qaction.cpp:1257 #27 0x00007fa437dec660 in QAction::event (this=0x103d5d0, e=0x7ffff022fd70) at /home/kde4/svn/qt/src/gui/kernel/qaction.cpp:1183 #28 0x00007fa438d0b0e7 in KAction::event (this=0x103d5d0, event=0x7ffff022fd70) at /home/snoopy/src/kdelibs/kdeui/actions/kaction.cpp:131 #29 0x00007fa437dfd0b6 in QApplicationPrivate::notify_helper (this=0x685420, receiver=0x103d5d0, e=0x7ffff022fd70) at /home/kde4/svn/qt/src/gui/kernel/qapplication.cpp:4440 #30 0x00007fa437dfa6da in QApplication::notify (this=0x7ffff02316b0, receiver=0x103d5d0, e=0x7ffff022fd70) at /home/kde4/svn/qt/src/gui/kernel/qapplication.cpp:3840 #31 0x00007fa438e184bd in KApplication::notify (this=0x7ffff02316b0, receiver=0x103d5d0, event=0x7ffff022fd70) at /home/snoopy/src/kdelibs/kdeui/kernel/kapplication.cpp:311 #32 0x00007fa436a7411b in QCoreApplication::notifyInternal (this=0x7ffff02316b0, receiver=0x103d5d0, event=0x7ffff022fd70) at /home/kde4/svn/qt/src/corelib/kernel/qcoreapplication.cpp:732 #33 0x00007fa437dedbeb in QCoreApplication::sendEvent (receiver=0x103d5d0, event=0x7ffff022fd70) at ../../include/QtCore/../../../../qt/src/corelib/kernel/qcoreapplication.h:215 #34 0x00007fa437e3d6f4 in QShortcutMap::dispatchEvent (this=0x685548, e=0x7ffff02305a0) at /home/kde4/svn/qt/src/gui/kernel/qshortcutmap.cpp:879 #35 0x00007fa437e3be7b in QShortcutMap::tryShortcutEvent (this=0x685548, o=0xd629c0, e=0x7ffff02305a0) at /home/kde4/svn/qt/src/gui/kernel/qshortcutmap.cpp:364 #36 0x00007fa437dfa979 in QApplication::notify (this=0x7ffff02316b0, receiver=0xd629c0, e=0x7ffff02305a0) at /home/kde4/svn/qt/src/gui/kernel/qapplication.cpp:3882 #37 0x00007fa438e184bd in KApplication::notify (this=0x7ffff02316b0, receiver=0xd629c0, event=0x7ffff02305a0) at /home/snoopy/src/kdelibs/kdeui/kernel/kapplication.cpp:311 #38 0x00007fa436a7411b in QCoreApplication::notifyInternal (this=0x7ffff02316b0, receiver=0xd629c0, event=0x7ffff02305a0) at /home/kde4/svn/qt/src/corelib/kernel/qcoreapplication.cpp:732 #39 0x00007fa437dff86b in QCoreApplication::sendSpontaneousEvent (receiver=0xd629c0, event=0x7ffff02305a0) at ../../include/QtCore/../../../../qt/src/corelib/kernel/qcoreapplication.h:218 #40 0x00007fa437dfd409 in qt_sendSpontaneousEvent (receiver=0xd629c0, event=0x7ffff02305a0) at /home/kde4/svn/qt/src/gui/kernel/qapplication.cpp:5434 #41 0x00007fa437ed2cef in QKeyMapper::sendKeyEvent (keyWidget=0xd629c0, grab=false, type=QEvent::KeyPress, code=67, modifiers=..., text=..., autorepeat=false, count=1, nativeScanCode=54, nativeVirtualKey=99, nativeModifiers=20) at /home/kde4/svn/qt/src/gui/kernel/qkeymapper_x11.cpp:1867 #42 0x00007fa437ed29f4 in QKeyMapperPrivate::translateKeyEvent (this=0x6cd0f0, keyWidget=0xd629c0, event=0x7ffff02312a0, grab=false) at /home/kde4/svn/qt/src/gui/kernel/qkeymapper_x11.cpp:1837 #43 0x00007fa437e9af9f in QApplication::x11ProcessEvent (this=0x7ffff02316b0, event=0x7ffff02312a0) at /home/kde4/svn/qt/src/gui/kernel/qapplication_x11.cpp:3456 #44 0x00007fa437ed4d9c in x11EventSourceDispatch (s=0x688c30, callback=0, user_data=0x0) at /home/kde4/svn/qt/src/gui/kernel/qguieventdispatcher_glib.cpp:146 #45 0x00007fa43013cbd3 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0 #46 0x00007fa43013d3b0 in ?? () from /lib64/libglib-2.0.so.0 #47 0x00007fa43013d650 in g_main_context_iteration () from /lib64/libglib-2.0.so.0 #48 0x00007fa436aad1bd in QEventDispatcherGlib::processEvents (this=0x64ef90, flags=...) at /home/kde4/svn/qt/src/corelib/kernel/qeventdispatcher_glib.cpp:415 #49 0x00007fa437ed514a in QGuiEventDispatcherGlib::processEvents (this=0x64ef90, flags=...) at /home/kde4/svn/qt/src/gui/kernel/qguieventdispatcher_glib.cpp:204 #50 0x00007fa436a71c7e in QEventLoop::processEvents (this=0x7ffff0231650, flags=...) at /home/kde4/svn/qt/src/corelib/kernel/qeventloop.cpp:149 #51 0x00007fa436a71dd2 in QEventLoop::exec (this=0x7ffff0231650, flags=...) at /home/kde4/svn/qt/src/corelib/kernel/qeventloop.cpp:201 #52 0x00007fa436a7480e in QCoreApplication::exec () at /home/kde4/svn/qt/src/corelib/kernel/qcoreapplication.cpp:1009 #53 0x00007fa437dfa252 in QApplication::exec () at /home/kde4/svn/qt/src/gui/kernel/qapplication.cpp:3714 #54 0x00007fa43c636ade in kdemain (argc=2, argv=0x7ffff0231898) at /home/snoopy/src/calligra/words/part/main.cpp:43 #55 0x0000000000400986 in main (argc=2, argv=0x7ffff0231898) at /home/kde4/svn/build/calligra/words/part/words_dummy.cpp:3 ups, stupid typo, I meaned Boudewijn :-/ sorry I guess the problem here is that we copy+paste only part of the ODF-code. So, probably we have an KoParagraphStyle::SectionEnd without a text:section in the ODF... I did some investigation of this a while back and I think you're right. The thing is that with the approach to saving section start/ends that we have now, where the section start saved on the first block (i think) of the section, it won't work for nested structures such as <text:section text:style-name="Sect1" text:name="Område1"> <text:section text:style-name="Sect1" text:name="Område2"> <text:p text:style-name="Standard">blah</text:p> </text:section> <text:p text:style-name="Standard">blah</text:p> </text:section> where there's no <p> in between one opening <section> and the next. It will result in a mismatch, and hence this crash. I sort of promised Casper I would look into saving multiple section starts per block instead (perhaps as a stack), which would fix this. But school caught up with me and now I have no time :/ But that's what needs to be done. I'll attach a minimal file I created that provokes this crash. Created attachment 60339 [details]
Minimal example .odt that provokes this crash
Minimal example .odt that provokes this crash. It has the following structure in content.xml:
<text:section text:style-name="Sect1" text:name="Område1">
<text:section text:style-name="Sect1" text:name="Område2">
<text:p text:style-name="Standard">inside inner</text:p>
</text:section>
<text:p text:style-name="Standard">insider outer, after inner</text:p>
</text:section>
Ehm. And with "I think you're right" I mean "I think you're wrong, but..." ;) Fixed with e0334411db7390900c793c1ad938f5f0b40bfe3a |
Created attachment 59007 [details] file that crashes Version: unspecified OS: Linux open the given document, do ctrl-a to select all text, then do ctrl-c to copy it into the buffer, this will cause a crash Reproducible: Didn't try Application: Words (words), signal: Segmentation fault [KCrash Handler] #6 KoTableOfContentsGeneratorInfo::tableOfContentData (this=0x0) at /home/oever/work/nokia/src/calligra/libs/kotext/KoTableOfContentsGeneratorInfo.cpp:226 #7 0x00007fc8ed653bb7 in KoTextWriter::Private::saveTableOfContents (this=0x2f4fe80, document=0x2353f70, from=1, to=30, listStyles=..., currentTable=0x0, toc=0x2301200) at /home/oever/work/nokia/src/calligra/libs/kotext/opendocument/KoTextWriter.cpp:596 #8 0x00007fc8ed65109d in KoTextWriter::Private::writeBlocks (this=0x2f4fe80, document=0x2353f70, from=0, to=747, listStyles=..., currentTable=0x0, currentFrame=0x0, deleteChangeBlocks=false) at /home/oever/work/nokia/src/calligra/libs/kotext/opendocument/KoTextWriter.cpp:635 #9 0x00007fc8ed651faf in KoTextWriter::write (this=0x7fffb03706b0, document=0x2353f70, from=0, to=747) at /home/oever/work/nokia/src/calligra/libs/kotext/opendocument/KoTextWriter.cpp:816 #10 0x00007fc8ed5c3b0a in KoTextShapeData::saveOdf (this=<value optimized out>, context=<value optimized out>, rdfData=<value optimized out>, from=0, to=747) at /home/oever/work/nokia/src/calligra/libs/kotext/KoTextShapeData.cpp:226 #11 0x00007fc8ed5c86a1 in KoTextOdfSaveHelper::writeBody (this=0x7fffb03709d0) at /home/oever/work/nokia/src/calligra/libs/kotext/KoTextOdfSaveHelper.cpp:69 #12 0x00007fc8ed65934f in KoTextDrag::setOdf (this=0x7fffb0370a70, mimeType=0x7fc8ed024bc0 "application/vnd.oasis.opendocument.text", helper=...) at /home/oever/work/nokia/src/calligra/libs/kotext/KoTextDrag.cpp:109 #13 0x00007fc8dcb5d80c in TextTool::copy (this=0x25a65f0) at /home/oever/work/nokia/src/calligra/plugins/textshape/TextTool.cpp:867 #14 0x00007fc8ed29aee5 in KoCopyController::qt_metacall (this=0x2eaa650, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fffb0370bb0) at /home/oever/work/nokia/build/calligra/libs/flake/KoCopyController.moc:82 #15 0x0000003c9df7004f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4 #16 0x00000032037b1252 in QAction::triggered(bool) () from /usr/lib64/libQtGui.so.4 #17 0x00000032037b144a in QAction::activate(QAction::ActionEvent) () from /usr/lib64/libQtGui.so.4 #18 0x00000032037b15c7 in QAction::event(QEvent*) () from /usr/lib64/libQtGui.so.4 #19 0x0000003207f5daad in KAction::event(QEvent*) () from /usr/lib64/libkdeui.so.5 #20 0x00000032037b78c4 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4 #21 0x00000032037bc3da in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4 #22 0x0000003208040466 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5 #23 0x0000003c9df5b7ac in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4 #24 0x00000032037e9f60 in ?? () from /usr/lib64/libQtGui.so.4 #25 0x00000032037eb468 in ?? () from /usr/lib64/libQtGui.so.4 #26 0x00000032037bdf8c in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4 #27 0x0000003208040466 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5 #28 0x0000003c9df5b7ac in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4 #29 0x000000320385840a in ?? () from /usr/lib64/libQtGui.so.4 #30 0x000000320385888d in ?? () from /usr/lib64/libQtGui.so.4 #31 0x0000003203834d0c in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib64/libQtGui.so.4 #32 0x000000320385c896 in ?? () from /usr/lib64/libQtGui.so.4 #33 0x000000302de41e33 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0 #34 0x000000302de42610 in ?? () from /lib64/libglib-2.0.so.0 #35 0x000000302de428ad in g_main_context_iteration () from /lib64/libglib-2.0.so.0 #36 0x0000003c9df868bf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4 #37 0x000000320385c59e in ?? () from /usr/lib64/libQtGui.so.4 #38 0x0000003c9df5ab42 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4 #39 0x0000003c9df5ad8c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4 #40 0x0000003c9df5f24b in QCoreApplication::exec() () from /usr/lib64/libQtCore.so.4 #41 0x00007fc8ede5e71d in kdemain (argc=<value optimized out>, argv=<value optimized out>) at /home/oever/work/nokia/src/calligra/words/part/main.cpp:38 #42 0x000000302c21ee5d in __libc_start_main () from /lib64/libc.so.6 #43 0x0000000000400789 in _start ()