Bug 317235

Summary: Kate crashes with code folding and then press "up" in certain circumstances
Product: [Applications] kate Reporter: neutrino0311
Component: generalAssignee: KWrite Developers <kwrite-bugs-null>
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description neutrino0311 2013-03-23 15:36:20 UTC
Application: kate (3.9.5)
KDE Platform Version: 4.9.5
Qt Version: 4.8.3
Operating System: Linux 3.5.0-26-generic x86_64
Distribution: Ubuntu 12.10

-- Information about the crash:
- What I was doing when the application crashed:
100% reproducable following this steps: (not the only way, just make an example)
(1) new a document, set tool->mode->script->JavaScript
(2) edit a foldable content with more than 2 inner lines like the following 4 lines:
  a: 1,
  b: 2
(3) cursor at 3rd line ( "  b:2"  ), using shortcut key ctrl + - to fold this block
// (3-1)  note!! if cursor is at the 2nd line, won't cause crash in step 4
// (3-2)  note!! using mouse to click the "folding icon" in the left, won't cause crash in step 4
(4) press "up" arrow key
(5) I've tried Mode in C++, Python, html, JSON, all crash with similar test case (1)~(4)

In the contrast, the following way won't crash:
(A) if edit the content first, and then set "Tool->Mode->JavaScript", sometimes it doesn't crash.
(B) if there is one line before the first "{", sometimes it doesn't crash.
In these two cases, the critical condition is not identified yet.
(C) With the two "do-not-crash" scenario mentioned in the (3), or with the other two "do-not-crash" in (A) or (B), after these kind of actions, then SOMETIMES won't crash even the content is the same like the content of (1)~(4).

- Custom settings of the application:
My system : Ubuntu-12.10 amd64, desktop env: kubuntu plasma (installed by apt-get install kubuntu-desktop)
There are two shortcut key using ctrl + - : one is folding, one is font resize(zoom out). I assigned font shrink to nothing.

The crash can be reproduced every time.

-- Backtrace:
Application: Kate (kate), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7fa71c273780 (LWP 29457))]

Thread 3 (Thread 0x7fa708abd700 (LWP 29458)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007fa70974acd7 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#2  0x00007fa70974ad09 in ?? () from /usr/lib/x86_64-linux-gnu/libQtScript.so.4
#3  0x00007fa7191b8e9a in start_thread (arg=0x7fa708abd700) at pthread_create.c:308
#4  0x00007fa71bb76cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#5  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7fa706a69700 (LWP 29459)):
#0  0x00007fa718ce971a in g_main_context_query () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007fa718ce9cf9 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fa718ce9ea4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007fa719ab1c16 in QEventDispatcherGlib::processEvents (this=0x7fa7000008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#4  0x00007fa719a822bf in QEventLoop::processEvents (this=this@entry=0x7fa706a68dd0, flags=...) at kernel/qeventloop.cpp:149
#5  0x00007fa719a82548 in QEventLoop::exec (this=0x7fa706a68dd0, flags=...) at kernel/qeventloop.cpp:204
#6  0x00007fa719983b10 in QThread::exec (this=<optimized out>) at thread/qthread.cpp:501
#7  0x00007fa719a629af in QInotifyFileSystemWatcherEngine::run (this=0x1083050) at io/qfilesystemwatcher_inotify.cpp:248
#8  0x00007fa719986aec in QThreadPrivate::start (arg=0x1083050) at thread/qthread_unix.cpp:338
#9  0x00007fa7191b8e9a in start_thread (arg=0x7fa706a69700) at pthread_create.c:308
#10 0x00007fa71bb76cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#11 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7fa71c273780 (LWP 29457)):
[KCrash Handler]
#6  KateLineLayout::viewLineCount (this=0x0) at ../../part/render/katelinelayout.cpp:173
#7  0x00007fa709dc9418 in KateLineLayout::viewLine (this=<optimized out>, viewLine=<optimized out>) at ../../part/render/katelinelayout.cpp:179
#8  0x00007fa709dc5f56 in KateLayoutCache::textLayout (this=<optimized out>, realLine=<optimized out>, _viewLine=-1) at ../../part/render/katelayoutcache.cpp:351
#9  0x00007fa709e0ed1a in KateViewInternal::previousLayout (this=this@entry=0xcd1290) at ../../part/view/kateviewinternal.cpp:1257
#10 0x00007fa709e19013 in KateViewInternal::cursorUp (this=0xcd1290, sel=<optimized out>) at ../../part/view/kateviewinternal.cpp:1425
#11 0x00007fa719a98f5f in QMetaObject::activate (sender=0xd8c7c0, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fffdee11df0) at kernel/qobject.cpp:3547
#12 0x00007fa71af9ca32 in QAction::triggered (this=this@entry=0xd8c7c0, _t1=false) at .moc/release-shared/moc_qaction.cpp:277
#13 0x00007fa71af9cc20 in QAction::activate (this=0xd8c7c0, event=event@entry=QAction::Trigger) at kernel/qaction.cpp:1257
#14 0x00007fa71af9cd87 in QAction::event (this=<optimized out>, e=<optimized out>) at kernel/qaction.cpp:1183
#15 0x00007fa71a1a5867 in KAction::event (this=<optimized out>, event=0x7fffdee12390) at ../../kdeui/actions/kaction.cpp:131
#16 0x00007fa71afa2e9c in QApplicationPrivate::notify_helper (this=this@entry=0x806ec0, receiver=receiver@entry=0xd8c7c0, e=e@entry=0x7fffdee12390) at kernel/qapplication.cpp:4562
#17 0x00007fa71afa730a in QApplication::notify (this=0x7fffdee13bd0, receiver=0xd8c7c0, e=0x7fffdee12390) at kernel/qapplication.cpp:4423
#18 0x00007fa71a27f1f6 in KApplication::notify (this=0x7fffdee13bd0, receiver=0xd8c7c0, event=0x7fffdee12390) at ../../kdeui/kernel/kapplication.cpp:311
#19 0x00007fa719a8356e in QCoreApplication::notifyInternal (this=0x7fffdee13bd0, receiver=0xd8c7c0, event=0x7fffdee12390) at kernel/qcoreapplication.cpp:915
#20 0x00007fa71afd3d74 in sendEvent (event=0x7fffdee12390, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#21 QShortcutMap::dispatchEvent (this=this@entry=0x806fe0, e=e@entry=0x7fffdee12960) at kernel/qshortcutmap.cpp:884
#22 0x00007fa71afd53a3 in QShortcutMap::tryShortcutEvent (this=0x806fe0, o=<optimized out>, e=0x7fffdee12960) at kernel/qshortcutmap.cpp:364
#23 0x00007fa71afa8fe9 in QApplication::notify (this=0x7fffdee13bd0, receiver=0xcd1290, e=0x7fffdee12960) at kernel/qapplication.cpp:3986
#24 0x00007fa71a27f1f6 in KApplication::notify (this=0x7fffdee13bd0, receiver=0xcd1290, event=0x7fffdee12960) at ../../kdeui/kernel/kapplication.cpp:311
#25 0x00007fa719a8356e in QCoreApplication::notifyInternal (this=0x7fffdee13bd0, receiver=0xcd1290, event=0x7fffdee12960) at kernel/qcoreapplication.cpp:915
#26 0x00007fa71b043e79 in QKeyMapper::sendKeyEvent (keyWidget=keyWidget@entry=0xcd1290, grab=grab@entry=false, type=QEvent::KeyPress, code=16777235, modifiers=..., text=..., autorepeat=autorepeat@entry=false, count=1, nativeScanCode=111, nativeVirtualKey=65362, nativeModifiers=0) at kernel/qkeymapper_x11.cpp:1866
#27 0x00007fa71b0442b1 in QKeyMapperPrivate::translateKeyEvent (this=0x848ea0, keyWidget=0xcd1290, event=0x7fffdee13390, grab=<optimized out>) at kernel/qkeymapper_x11.cpp:1836
#28 0x00007fa71b01fed9 in QApplication::x11ProcessEvent (this=0x7fffdee13bd0, event=0x7fffdee13390) at kernel/qapplication_x11.cpp:3630
#29 0x00007fa71b047fa2 in x11EventSourceDispatch (s=0x808970, callback=0x0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#30 0x00007fa718ce9ab5 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#31 0x00007fa718ce9de8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007fa718ce9ea4 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007fa719ab1bf6 in QEventDispatcherGlib::processEvents (this=0x7ccb30, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#34 0x00007fa71b047c1e in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#35 0x00007fa719a822bf in QEventLoop::processEvents (this=this@entry=0x7fffdee13760, flags=...) at kernel/qeventloop.cpp:149
#36 0x00007fa719a82548 in QEventLoop::exec (this=0x7fffdee13760, flags=...) at kernel/qeventloop.cpp:204
#37 0x00007fa719a87708 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1187
#38 0x00007fa71be664bd in kdemain (argc=<optimized out>, argv=0x7fffdee13d00) at ../../../kate/app/katemain.cpp:377
#39 0x00007fa71baa476d in __libc_start_main (main=0x400690 <main(int, char**)>, argc=1, ubp_av=0x7fffdee13d58, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffdee13d48) at libc-start.c:226
#40 0x00000000004006c1 in _start ()

This bug may be a duplicate of or related to bug 311866.

Possible duplicates by query: bug 311866, bug 302298, bug 260996, bug 257510, bug 256452.

Reported using DrKonqi
Comment 1 Dominik Haumann 2013-03-23 15:43:08 UTC
Thanks for the report, it's a known and reproducible issue we hope to resolve as soon as possible.

*** This bug has been marked as a duplicate of bug 311866 ***