Version: (using Devel) Installed from: Compiled sources Compiler: g++ (GCC) 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2) OS: Linux Open kwrite or kate, and set the following options: - Enable static word wrap (By default, it wraps words at 80 chars. I di not test other configurations) - Indentation width: 2 Chars (Should not really matter) Type " " (10 \t characters) Set the cursor in the middle of the line (for example after the 3rd \t) Type anything, for example "Using static word wrap and being mean at it". The editor should crash when starting to type "and" as it tries to wrap the tab to the following line. More details about the crash: The executions fails due to a Q_ASSERT(m_textLine) that is not verified, in const KateTextLine::Ptr& KateLineLayout::textLine() const; After applying the following patch (simply removing shiftAmount from void KateLayoutCache::slotEditDone(KateEditInfo* edit); which most likely induces a lot of other issues), the problem can no more be reproduced. I however failed to dig the real cause any further. [code] emeric@hawking:~/kde/src/KDE/kdelibs/kate/render$ svn diff Index: katelayoutcache.cpp =================================================================== --- katelayoutcache.cpp (revision 778711) +++ katelayoutcache.cpp (working copy) @@ -331,9 +331,9 @@ { int fromLine = edit->oldRange().start().line(); int toLine = edit->oldRange().end().line(); - int shiftAmount = edit->translate().line(); +// int shiftAmount = edit->translate().line(); - if (shiftAmount) { + if (true/*shiftAmount*/) { QMap<int, KateLineLayoutPtr> oldMap = m_lineLayouts; m_lineLayouts.clear(); @@ -343,8 +343,8 @@ if (it.key() > toLine) { KateLineLayoutPtr layout = it.value(); - layout->setLine(layout->line() + shiftAmount); - m_lineLayouts.insert(it.key() + shiftAmount, layout); + layout->setLine(layout->line() /*+ shiftAmount*/); + m_lineLayouts.insert(it.key() /*+ shiftAmount*/, layout); } else if (it.key() < fromLine) { m_lineLayouts.insert(it.key(), it.value()); [/code] If anyone gets it fixed, I'd like to hear about the method used. That would greatly help the beginner I am.
Duplicate of http://bugs.kde.org/show_bug.cgi?id=157931
Crash confirmed on revision 779096. I've got no backtrace (even from gdb).
From revision 779548, I'm getting the following gdb backtrace when reproducing the crash: [code] ASSERT: "m_textLine" in file /home/emeric/kde/src/KDE/kdelibs/kate/render/katelinelayout.cpp, line 68 Program received signal SIGABRT, Aborted. [Switching to Thread -1237010752 (LWP 13295)] 0xffffe410 in __kernel_vsyscall () (gdb) bt #0 0xffffe410 in __kernel_vsyscall () #1 0xb67f3875 in raise () from /lib/tls/i686/cmov/libc.so.6 #2 0xb67f5201 in abort () from /lib/tls/i686/cmov/libc.so.6 #3 0xb72d801d in qt_message_output () from /usr/lib/libQtCore.so.4 #4 0xb72d80a1 in qFatal () from /usr/lib/libQtCore.so.4 #5 0xb72d820d in qt_assert () from /usr/lib/libQtCore.so.4 #6 0xb4a16375 in KateLineLayout::textLine (this=0x8b31b68) at /home/emeric/kde/src/KDE/kdelibs/kate/render/katelinelayout.cpp:68 #7 0xb4a163e1 in KateLineLayout::isValid (this=0x8b31b68) at /home/emeric/kde/src/KDE/kdelibs/kate/render/katelinelayout.cpp:120 #8 0xb4a14ebe in KateTextLayout::isValid (this=0x83ee178) at /home/emeric/kde/src/KDE/kdelibs/kate/render/katetextlayout.cpp:90 #9 0xb4a15363 in KateTextLayout::line (this=0x83ee178) at /home/emeric/kde/src/KDE/kdelibs/kate/render/katetextlayout.cpp:95 #10 0xb4a12fd4 in KateLayoutCache::updateViewCache (this=0x8206718, startPos=@0x8207df0, newViewLineCount=39, viewLinesScrolled=0) at /home/emeric/kde/src/KDE/kdelibs/kate/render/katelayoutcache.cpp:129 #11 0xb4a5bbee in KateViewInternal::tagLines (this=0x8207d08, start=@0xbff4bf30, end=@0xbff4bf20, realCursors=true) at /home/emeric/kde/src/KDE/kdelibs/kate/view/kateviewinternal.cpp:1925 #12 0xb4a5c100 in KateViewInternal::tagLines (this=0x8207d08, start=0, end=2, realLines=true) at /home/emeric/kde/src/KDE/kdelibs/kate/view/kateviewinternal.cpp:1895 #13 0xb4a4c83d in KateView::tagLines (this=0x82037d8, start=0, end=2, realLines=true) at /home/emeric/kde/src/KDE/kdelibs/kate/view/kateview.cpp:1335 #14 0xb49bc2c9 in KateDocument::tagLines (this=0x81fd620, start=0, end=2) at /home/emeric/kde/src/KDE/kdelibs/kate/document/katedocument.cpp:4956 #15 0xb49d7030 in KateDocument::qt_metacall (this=0x81fd620, _c=QMetaObject::InvokeMetaMethod, _id=51, _a=0xbff4c518) at /home/emeric/kde/build/KDE/kdelibs/kate/katedocument.moc:296 #16 0xb73a7c04 in QMetaObject::activate () from /usr/lib/libQtCore.so.4 #17 0xb73a8079 in QMetaObject::activate () from /usr/lib/libQtCore.so.4 #18 0xb49e4a47 in KateBuffer::tagLines (this=0x80a8b60, _t1=0, _t2=2) at /home/emeric/kde/build/KDE/kdelibs/kate/katebuffer.moc:84 #19 0xb49e5d67 in KateBuffer::doHighlight (this=0x80a8b60, startLine=0, endLine=2, invalidate=true) at /home/emeric/kde/src/KDE/kdelibs/kate/document/katebuffer.cpp:1042 #20 0xb49e5f8f in KateBuffer::editEnd (this=0x80a8b60) at /home/emeric/kde/src/KDE/kdelibs/kate/document/katebuffer.cpp:352 #21 0xb49cd0ca in KateDocument::editEnd (this=0x81fd620) at /home/emeric/kde/src/KDE/kdelibs/kate/document/katedocument.cpp:1094 #22 0xb49d0461 in KateDocument::typeChars (this=0x81fd620, view=0x82037d8, chars=@0xbff4c8f8) at /home/emeric/kde/src/KDE/kdelibs/kate/document/katedocument.cpp:4057 #23 0xb4a62103 in KateViewInternal::keyPressEvent (this=0x8207d08, e=0xbff4ce14) at /home/emeric/kde/src/KDE/kdelibs/kate/view/kateviewinternal.cpp:2223 #24 0xb4a5f4e7 in KateViewInternal::eventFilter (this=0x8207d08, obj=0x8207d08, e=0xbff4ce14) at /home/emeric/kde/src/KDE/kdelibs/kate/view/kateviewinternal.cpp:2067 #25 0xb6b723c8 in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4 #26 0xb6b72a83 in QApplication::notify () from /usr/lib/libQtGui.so.4 ---Type <return> to continue, or q <return> to quit--- #27 0xb7936bb3 in KApplication::notify (this=0xbff4d7c0, receiver=0x8207d08, event=0xbff4ce14) at /home/emeric/kde/src/KDE/kdelibs/kdeui/kernel/kapplication.cpp:314 #28 0xb7396456 in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4 #29 0xb6b7d81d in ?? () from /usr/lib/libQtGui.so.4 #30 0xbff4d7c0 in ?? () #31 0x08207d08 in ?? () #32 0xbff4ce14 in ?? () #33 0xbff4ce94 in ?? () #34 0x0851c7d8 in ?? () #35 0xb71d12d8 in ?? () from /usr/lib/libQtGui.so.4 #36 0xbff4cdb8 in ?? () #37 0xb6bd0280 in ?? () from /usr/lib/libQtGui.so.4 #38 0x08207d08 in ?? () #39 0xbff4ce14 in ?? () #40 0xbff4cea8 in ?? () #41 0xb6c082a8 in ?? () from /usr/lib/libQtGui.so.4 #42 0x08207d08 in ?? () #43 0xbff4ce14 in ?? () #44 0x00000041 in ?? () #45 0xbff4ce94 in ?? () #46 0xbff4cf9c in ?? () #47 0x00000000 in ?? () [/code] If this can be of any help ?
Related: #157931, #157737
*** Bug 161831 has been marked as a duplicate of this bug. ***
*** Bug 164620 has been marked as a duplicate of this bug. ***
SVN commit 825820 by dhaumann: fix: Crashes when using static word wrap and trying to wrap a tab character KateEditInfo's translate() was wrong if a new line was NOT added. We have to handle the two cases separately: word wrap with new line inserted and word wrap without new line inserted BUG: 158336 M +7 -4 katedocument.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=825820