Bug 226409

Summary: [testcase] KateSmartGroup handling broken [null, KateSmartManager::groupForLine, KateLineLayout::viewLineCount, KateLayoutCache::viewLine, KateLayoutCache::textLayout]
Product: [Applications] kate Reporter: Eike Hein <hein>
Component: partAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: critical CC: aaron, alpha_one_x86, andresbajotierra, anton, bucky, christoph, eduardosanchezmunoz, erm2587, fabianrost, fenixk19, fmp0d6sw, goodladybird, husdis, incompetent777, itissohardtothinkofagoodemail, kay.abendroth, kuba, lev.krainov, lizajane999, lothar, lyngeled, macbeth8, markus.hauser, michaelcochez, neroslavsky, pjcdawkins, savkiny, sbastig, selth.blackwings, wasserman.louis
Priority: VHI    
Version: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 4.4.4
Sentry Crash Report:
Attachments: File involved in crash

Description Eike Hein 2010-02-11 22:32:58 UTC
Application: kate (3.4.0)
KDE Platform Version: 4.4.00 (KDE 4.4.0)
Qt Version: 4.6.1
Operating System: Linux 2.6.32.7-37.fc12.x86_64 x86_64
Distribution: "Fedora release 12 (Constantine)"

-- Information about the crash:
I opened a file, selected several lines at the end of the document and pressed Backspace to remove them, and Kate blew up in my face. Reproducably.

I'm going to attach the file and point out extent of the text selection.

The crash can be reproduced every time.

 -- Backtrace:
Application: Kate (kate), signal: Segmentation fault
82	T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
[Current thread is 1 (Thread 0x7f6a3dbec840 (LWP 2685))]

Thread 2 (Thread 0x7f6a35abd710 (LWP 2686)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x0000003280f273e6 in QTWTF::TCMalloc_PageHeap::scavengerThread (this=0x3281200b20) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:2304
#2  0x0000003280f27429 in QTWTF::TCMalloc_PageHeap::runScavengerThread (context=0x328120ebec) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:1438
#3  0x000000374ac06a3a in start_thread (arg=<value optimized out>) at pthread_create.c:297
#4  0x000000374a0de67d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#5  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f6a3dbec840 (LWP 2685)):
[KCrash Handler]
#5  KateLineLayout::viewLineCount (this=0x0) at /usr/src/debug/kdelibs-4.4.0/kate/render/katelinelayout.cpp:173
#6  0x00007f6a35ba278a in KateLayoutCache::viewLine (this=0x34c16d0, realCursor=...) at /usr/src/debug/kdelibs-4.4.0/kate/render/katelayoutcache.cpp:395
#7  0x00007f6a35ba2d71 in KateLayoutCache::textLayout (this=0x34c16d0, realCursor=...) at /usr/src/debug/kdelibs-4.4.0/kate/render/katelayoutcache.cpp:337
#8  0x00007f6a35c00eaf in KateViewInternal::makeVisible (this=0x34c0da0, c=<value optimized out>, endCol=<value optimized out>, force=false, center=<value optimized out>, 
    calledExternally=<value optimized out>) at /usr/src/debug/kdelibs-4.4.0/kate/view/kateviewinternal.cpp:690
#9  0x00007f6a35c01569 in KateViewInternal::updateCursor (this=0x34c0da0, newCursor=<value optimized out>, force=<value optimized out>, center=false, calledExternally=<value optimized out>)
    at /usr/src/debug/kdelibs-4.4.0/kate/view/kateviewinternal.cpp:1912
#10 0x00007f6a35c02149 in KateViewInternal::editEnd (this=0x34c0da0, editTagLineStart=<value optimized out>, editTagLineEnd=<value optimized out>, tagFrom=<value optimized out>)
    at /usr/src/debug/kdelibs-4.4.0/kate/view/kateviewinternal.cpp:3397
#11 0x00007f6a35b645e1 in KateDocument::editEnd (this=0x2847b00) at /usr/src/debug/kdelibs-4.4.0/kate/document/katedocument.cpp:981
#12 0x00007f6a35b6b260 in KateDocument::removeText (this=0x2847b00, _range=<value optimized out>, block=<value optimized out>) at /usr/src/debug/kdelibs-4.4.0/kate/document/katedocument.cpp:825
#13 0x00007f6a35b6cdaa in KateDocument::backspace (this=0x2847b00, view=<value optimized out>, c=<value optimized out>) at /usr/src/debug/kdelibs-4.4.0/kate/document/katedocument.cpp:2893
#14 0x00007f6a35bea13c in KateView::backspace (this=0x34bd050) at /usr/src/debug/kdelibs-4.4.0/kate/view/kateview.cpp:2296
#15 0x00007f6a35bee81d in KateView::qt_metacall (this=0x34bd050, _c=InvokeMetaMethod, _id=51, _a=0x7fff60c18ee0) at /usr/src/debug/kdelibs-4.4.0/x86_64-redhat-linux-gnu/kate/kateview.moc:373
#16 0x0000003276568adf in QMetaObject::activate (sender=0x357fde0, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x7fff60c18ee0) at kernel/qobject.cpp:3275
#17 0x0000003276fa59e2 in QAction::triggered (this=<value optimized out>, _t1=false) at .moc/release-shared/moc_qaction.cpp:263
#18 0x0000003276fa711b in QAction::activate (this=0x357fde0, event=<value optimized out>) at kernel/qaction.cpp:1251
#19 0x0000003276fa81d7 in QAction::event (this=<value optimized out>, e=<value optimized out>) at kernel/qaction.cpp:1177
#20 0x000000348794becd in KAction::event (this=<value optimized out>, event=0x7fff60c19550) at /usr/src/debug/kdelibs-4.4.0/kdeui/actions/kaction.cpp:129
#21 0x0000003276faa86c in QApplicationPrivate::notify_helper (this=0x25c79e0, receiver=0x357fde0, e=0x7fff60c19550) at kernel/qapplication.cpp:4298
#22 0x0000003276fb093b in QApplication::notify (this=<value optimized out>, receiver=0x357fde0, e=0x7fff60c19550) at kernel/qapplication.cpp:4181
#23 0x0000003487a067f6 in KApplication::notify (this=0x7fff60c1ab90, receiver=0x357fde0, event=0x7fff60c19550) at /usr/src/debug/kdelibs-4.4.0/kdeui/kernel/kapplication.cpp:302
#24 0x000000327655696c in QCoreApplication::notifyInternal (this=0x7fff60c1ab90, receiver=0x357fde0, event=0x7fff60c19550) at kernel/qcoreapplication.cpp:704
#25 0x0000003276fdd926 in sendEvent (this=<value optimized out>, e=0x7fff60c19b50) at ../../src/corelib/kernel/qcoreapplication.h:215
#26 QShortcutMap::dispatchEvent (this=<value optimized out>, e=0x7fff60c19b50) at kernel/qshortcutmap.cpp:879
#27 0x0000003276fdf7d7 in QShortcutMap::tryShortcutEvent (this=0x25c7b08, o=<value optimized out>, e=0x7fff60c19b50) at kernel/qshortcutmap.cpp:364
#28 0x0000003276fb2463 in QApplication::notify (this=0x7fff60c1ab90, receiver=0x34c0da0, e=0x7fff60c19b50) at kernel/qapplication.cpp:3744
#29 0x0000003487a067f6 in KApplication::notify (this=0x7fff60c1ab90, receiver=0x34c0da0, event=0x7fff60c19b50) at /usr/src/debug/kdelibs-4.4.0/kdeui/kernel/kapplication.cpp:302
#30 0x000000327655696c in QCoreApplication::notifyInternal (this=0x7fff60c1ab90, receiver=0x34c0da0, event=0x7fff60c19b50) at kernel/qcoreapplication.cpp:704
#31 0x000000327704426a in QKeyMapper::sendKeyEvent (keyWidget=0x34c0da0, grab=<value optimized out>, type=KeyPress, code=16777219, modifiers=<value optimized out>, text=..., 
    autorepeat=<value optimized out>, count=<value optimized out>, nativeScanCode=<value optimized out>, nativeVirtualKey=<value optimized out>, nativeModifiers=<value optimized out>)
    at kernel/qkeymapper_x11.cpp:1861
#32 0x0000003277046680 in QKeyMapperPrivate::translateKeyEvent (this=<value optimized out>, keyWidget=0x34c0da0, event=<value optimized out>, grab=<value optimized out>)
    at kernel/qkeymapper_x11.cpp:1831
#33 0x0000003277020844 in QApplication::x11ProcessEvent (this=<value optimized out>, event=0x7fff60c1a720) at kernel/qapplication_x11.cpp:3394
#34 0x00000032770496b2 in x11EventSourceDispatch (s=0x25c99a0, callback=<value optimized out>, user_data=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:146
#35 0x000000327503920e in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#36 0x000000327503cbf8 in ?? () from /lib64/libglib-2.0.so.0
#37 0x000000327503cd1a in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#38 0x000000327657c2b3 in QEventDispatcherGlib::processEvents (this=0x25a2030, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:412
#39 0x000000327704937e in QGuiEventDispatcherGlib::processEvents (this=<value optimized out>, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:204
#40 0x00000032765553b2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#41 0x000000327655567c in QEventLoop::exec (this=0x7fff60c1aa50, flags=...) at kernel/qeventloop.cpp:201
#42 0x0000003276557969 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:981
#43 0x0000003489205b9d in kdemain (argc=<value optimized out>, argv=<value optimized out>) at /usr/src/debug/kdesdk-4.4.0/kate/app/katemain.cpp:377
#44 0x000000374a01eb1d in __libc_start_main (main=<value optimized out>, argc=<value optimized out>, ubp_av=<value optimized out>, init=<value optimized out>, fini=<value optimized out>, 
    rtld_fini=<value optimized out>, stack_end=<value optimized out>) at libc-start.c:226
#45 0x00000000004006c9 in _start ()

Possible duplicates by query: bug 224373, bug 223985, bug 223583, bug 223345, bug 219853.

Reported using DrKonqi
Comment 1 Eike Hein 2010-02-11 22:35:50 UTC
Created attachment 40698 [details]
File involved in crash

Select from the end upwards until the selection includes the "--- snip ---" line, then press Backspace -> kaboom.
Comment 2 Milian Wolff 2010-02-12 01:31:22 UTC
What kind of mode (i.e. indentation / folding / syntax highlighting) did you assign to the file? I could not reproduce the crash, please be more specific.
Comment 3 Eike Hein 2010-02-12 01:39:10 UTC
I did nothing manually, I just opened the file by double-clicking in Dolphin.

Mode: Tools -> Mode says "Normal".
Indentation: Tools -> Indentation says "None".
Folding: Folding markersd are disabled in the GUI (and thus nothing is folded).
Syntax highlighting: Tools -> Highlighting says "None".
Encoding: Tools -> Encoding says Utf-8.
Line endings: Tools -> End of Line says UNIX.
Comment 4 Milian Wolff 2010-02-12 01:52:37 UTC
How much of the file can you see when you open Kate? And you select just to the start of line 33 (i.e. just before the ---) or do you select the \n before (i.e. to the start of line 32? Do you delete with Backspace or with Delete? Do you select from start to end? From end to start?

Sorry that I bug you with so many questions, but I just can't reproduce the crash (and boy, would I like to do so... a reproduced bug is nearly a fixed bug ;-)).
Comment 5 Eike Hein 2010-02-12 01:59:46 UTC
It's ok, though I have answered some of these questions in my initial report already ;).

I can see all rows, but not all columns (word wrapping is disabled, so some of the long ones extend beyond the confines of the viewport).
I select from the end/bottom to the start/upwards.
I select to the start of line 33.
I delete with backspace.
Comment 6 Milian Wolff 2010-02-12 02:18:03 UTC
I still cannot reproduce, anyone else?
Comment 7 Eike Hein 2010-02-12 02:23:51 UTC
Actually, it turns out that my bug report was incomplete, mea culpa.

Kate does not crash after selecting from the end to the start of line 33 and pressing backspace - rather it crashes if I press backspace twice. I.e. select from the end to the start of line 33, press backspace, press backspace again.
Comment 8 Milian Wolff 2010-02-12 02:32:55 UTC
Thanks, this did the "trick", I reproduced it easily now.
Comment 9 Milian Wolff 2010-02-12 02:33:34 UTC
changing status
Comment 10 Milian Wolff 2010-02-12 02:34:51 UTC
*** Bug 223345 has been marked as a duplicate of this bug. ***
Comment 11 Christoph Cullmann 2010-02-15 23:25:50 UTC
SVN commit 1090734 by cullmann:

BUG: 226409
try to remove segfault, now the smartrangegroups overlap in strange ways but otherwise just the wrong group got resized, its end didnt match reality and cursors belonged to groups with end lines < cursor line

 M  +39 -3     katesmartmanager.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1090734
Comment 12 Christoph Cullmann 2010-02-16 12:56:29 UTC
*** Bug 226322 has been marked as a duplicate of this bug. ***
Comment 13 Dominik Haumann 2010-02-16 18:31:13 UTC
*** Bug 192606 has been marked as a duplicate of this bug. ***
Comment 14 Dominik Haumann 2010-03-01 18:02:27 UTC
*** Bug 228980 has been marked as a duplicate of this bug. ***
Comment 15 Dominik Haumann 2010-03-17 21:46:34 UTC
*** Bug 230001 has been marked as a duplicate of this bug. ***
Comment 16 Kay Abendroth 2010-03-18 11:37:47 UTC
It would be great to have that in 4.4.2 or 4.4.3, because of the crash it causes, which in daily work with Kate becomes very annoying.
Comment 17 Dominik Haumann 2010-03-20 17:57:06 UTC
*** Bug 231425 has been marked as a duplicate of this bug. ***
Comment 18 Dominik Haumann 2010-04-02 19:21:39 UTC
*** Bug 233081 has been marked as a duplicate of this bug. ***
Comment 19 Dominik Haumann 2010-04-14 19:43:31 UTC
*** Bug 234335 has been marked as a duplicate of this bug. ***
Comment 20 Dominik Haumann 2010-04-14 19:47:15 UTC
*** Bug 234364 has been marked as a duplicate of this bug. ***
Comment 21 Andreas Pakulat 2010-04-14 21:17:49 UTC
*** Bug 234382 has been marked as a duplicate of this bug. ***
Comment 22 Dominik Haumann 2010-04-14 22:25:38 UTC
Christoph, given this crash seems to appear very often, maybe we should consider backporting this one-liner? It's not really safe, but still seems to work...
Comment 23 Dominik Haumann 2010-05-09 04:43:34 UTC
*** Bug 235199 has been marked as a duplicate of this bug. ***
Comment 24 Dominik Haumann 2010-05-09 04:59:24 UTC
*** Bug 236041 has been marked as a duplicate of this bug. ***
Comment 25 Dominik Haumann 2010-05-09 22:36:50 UTC
*** Bug 237002 has been marked as a duplicate of this bug. ***
Comment 26 Christoph Cullmann 2010-05-10 06:22:02 UTC
Just backport then please, have no checkout here for branch stuff :/
I don't know why my change works btw. and let all praise that KDE 4.5 just doesn't use smart for any kate internal stuff ;) (uh oh, beside completion, this must still be fixed)
Comment 27 Dominik Haumann 2010-05-17 23:06:17 UTC
*** Bug 237966 has been marked as a duplicate of this bug. ***
Comment 28 Dominik Haumann 2010-05-22 23:49:07 UTC
*** Bug 238394 has been marked as a duplicate of this bug. ***
Comment 29 Dominik Haumann 2010-05-22 23:50:58 UTC
*** Bug 238292 has been marked as a duplicate of this bug. ***
Comment 30 Kay Abendroth 2010-05-27 12:49:10 UTC
Please backport this fix to 4.4.4 or 4.4.5 at least.

Kate crashing in the middle of editing a file is horrible by itself. If several files are open which were not saved a while its even worse. I had two crashes during the last two days.
Comment 31 Christoph Cullmann 2010-05-27 20:01:38 UTC
SVN commit 1131228 by cullmann:

backport fix for 226409
wrong stuff in smart leads to random segfault
BUG: 226409
this is a stupid and ugly workaround


 M  +3 -1      katesmartmanager.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1131228
Comment 32 Dominik Haumann 2010-05-28 01:42:08 UTC
*** Bug 233224 has been marked as a duplicate of this bug. ***
Comment 33 Dominik Haumann 2010-05-31 13:51:57 UTC
*** Bug 238887 has been marked as a duplicate of this bug. ***
Comment 34 Dominik Haumann 2010-06-10 00:24:24 UTC
*** Bug 241213 has been marked as a duplicate of this bug. ***
Comment 35 Dominik Haumann 2010-06-20 11:48:37 UTC
*** Bug 242205 has been marked as a duplicate of this bug. ***
Comment 36 Dominik Haumann 2010-07-01 23:15:33 UTC
*** Bug 238704 has been marked as a duplicate of this bug. ***
Comment 37 Dominik Haumann 2010-07-04 23:16:08 UTC
*** Bug 243604 has been marked as a duplicate of this bug. ***
Comment 38 Dario Andres 2010-11-21 15:16:12 UTC
*** Bug 257510 has been marked as a duplicate of this bug. ***
Comment 39 Dario Andres 2010-11-21 15:16:14 UTC
*** Bug 256452 has been marked as a duplicate of this bug. ***
Comment 40 Dario Andres 2010-11-21 15:16:18 UTC
*** Bug 255585 has been marked as a duplicate of this bug. ***
Comment 41 Dario Andres 2010-11-21 15:16:20 UTC
*** Bug 254587 has been marked as a duplicate of this bug. ***
Comment 42 Dario Andres 2010-11-21 15:16:23 UTC
*** Bug 254525 has been marked as a duplicate of this bug. ***
Comment 43 Dario Andres 2010-12-15 14:36:13 UTC
*** Bug 259857 has been marked as a duplicate of this bug. ***
Comment 44 Milian Wolff 2010-12-22 20:24:58 UTC
*** Bug 260996 has been marked as a duplicate of this bug. ***