Bug 315683

Summary: Kate crashes when selected text is deleted
Product: [Applications] kate Reporter: Markus Raab <debian>
Component: Vi Input ModeAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: crash CC: kdedevel, perezmeyer
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Markus Raab 2013-02-23 11:56:06 UTC
Application: kate (3.8.4)
KDE Platform Version: 4.8.4 (4.8.4)
Qt Version: 4.8.2
Operating System: Linux 3.2.0-4-amd64 x86_64
Distribution: Debian GNU/Linux 7.0 (wheezy)

-- Information about the crash:
- What I was doing when the application crashed:

I selected Text (either with V in vim mode or with mouse) at the very bottom (including the last line!) of a text document. When I press D (for deleting text) kate crashes.

- Custom settings of the application:

The VI-Insert mode is active
(but not the overwrite of kate and without status)

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 0x7fe302cc1760 (LWP 6465))]

Thread 2 (Thread 0x7fe2eeff6700 (LWP 6520)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:162
#1  0x00007fe2f012ce77 in QTWTF::TCMalloc_PageHeap::scavengerThread (this=0x7fe2f043a640) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:2359
#2  0x00007fe2f012cea9 in QTWTF::TCMalloc_PageHeap::runScavengerThread (context=<optimized out>) at ../3rdparty/javascriptcore/JavaScriptCore/wtf/FastMalloc.cpp:1464
#3  0x00007fe2ffc20b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#4  0x00007fe30262ca7d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#5  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7fe302cc1760 (LWP 6465)):
[KCrash Handler]
#6  KateLineLayout::viewLineCount (this=0x0) at ../../part/render/katelinelayout.cpp:173
#7  0x00007fe2f07bb03b in KateLayoutCache::lastViewLine (this=0x0, this@entry=0x18b81c0, realLine=25919936) at ../../part/render/katelayoutcache.cpp:461
#8  0x00007fe2f07bb089 in KateLayoutCache::viewLineCount (this=this@entry=0x18b81c0, realLine=<optimized out>) at ../../part/render/katelayoutcache.cpp:466
#9  0x00007fe2f07bb661 in KateLayoutCache::displayViewLine (this=0x18b81c0, virtualCursor=..., limitToVisible=true) at ../../part/render/katelayoutcache.cpp:437
#10 0x00007fe2f0806058 in KateViewInternal::cursorToCoordinate (this=this@entry=0x18b8750, cursor=..., realCursor=realCursor@entry=true, includeBorder=includeBorder@entry=false) at ../../part/view/kateviewinternal.cpp:715
#11 0x00007fe2f080a376 in KateViewInternal::inputMethodQuery (this=0x18b8750, query=<optimized out>) at ../../part/view/kateviewinternal.cpp:3415
#12 0x00007fe302022bb4 in QXIMInputContext::update (this=<optimized out>) at inputmethod/qximinputcontext_x11.cpp:819
#13 0x00007fe301aba218 in QWidget::updateMicroFocus (this=0x18b8750) at kernel/qwidget.cpp:11389
#14 0x00007fe2f080a9c1 in KateViewInternal::updateCursor (this=0x18b8750, newCursor=..., force=<optimized out>, center=false, calledExternally=false) at ../../part/view/kateviewinternal.cpp:1857
#15 0x00007fe2f082920d in KateViNormalMode::commandDeleteToEOL (this=0x1a5c900) at ../../part/vimode/katevinormalmode.cpp:708
#16 0x00007fe2f08355b6 in KateViNormalMode::executeCommand (this=this@entry=0x1a5c900, cmd=cmd@entry=0x1a62880) at ../../part/vimode/katevinormalmode.cpp:433
#17 0x00007fe2f08366c0 in KateViNormalMode::handleKeypress (this=0x1a5c900, e=<optimized out>) at ../../part/vimode/katevinormalmode.cpp:362
#18 0x00007fe2f081e404 in KateViInputModeManager::handleKeypress (this=0x1a42e20, e=0x7fffcdbb5500) at ../../part/vimode/kateviinputmodemanager.cpp:102
#19 0x00007fe2f080fefe in keyPressEvent (e=0x7fffcdbb5500, this=0x18b8750) at ../../part/view/kateviewinternal.cpp:2282
#20 KateViewInternal::keyPressEvent (this=0x18b8750, e=0x7fffcdbb5500) at ../../part/view/kateviewinternal.cpp:2215
#21 0x00007fe2f080822b in KateViewInternal::eventFilter (this=0x18b8750, obj=0x18b8750, e=0x7fffcdbb5500) at ../../part/view/kateviewinternal.cpp:2167
#22 0x00007fe3004f0cc6 in QCoreApplicationPrivate::sendThroughObjectEventFilters (this=<optimized out>, receiver=0x18b8750, event=0x7fffcdbb5500) at kernel/qcoreapplication.cpp:1025
#23 0x00007fe301a786dc in QApplicationPrivate::notify_helper (this=this@entry=0x11fd590, receiver=receiver@entry=0x18b8750, e=e@entry=0x7fffcdbb5500) at kernel/qapplication.cpp:4552
#24 0x00007fe301a7d704 in QApplication::notify (this=<optimized out>, receiver=0x18b8750, e=0x7fffcdbb5500) at kernel/qapplication.cpp:3997
#25 0x00007fe300d1e886 in KApplication::notify (this=0x7fffcdbb6760, receiver=0x18b8750, event=0x7fffcdbb5500) at ../../kdeui/kernel/kapplication.cpp:311
#26 0x00007fe3004f0b5e in QCoreApplication::notifyInternal (this=0x7fffcdbb6760, receiver=0x18b8750, event=0x7fffcdbb5500) at kernel/qcoreapplication.cpp:915
#27 0x00007fe301b15a9a in QKeyMapper::sendKeyEvent (keyWidget=keyWidget@entry=0x18b8750, grab=grab@entry=false, type=QEvent::KeyPress, code=68, modifiers=..., text=..., autorepeat=autorepeat@entry=false, count=1, nativeScanCode=40, nativeVirtualKey=68, nativeModifiers=1) at kernel/qkeymapper_x11.cpp:1866
#28 0x00007fe301b15ed1 in QKeyMapperPrivate::translateKeyEvent (this=0x1240250, keyWidget=0x18b8750, event=0x7fffcdbb5f20, grab=false) at kernel/qkeymapper_x11.cpp:1836
#29 0x00007fe301af2b28 in QApplication::x11ProcessEvent (this=0x7fffcdbb6760, event=0x7fffcdbb5f20) at kernel/qapplication_x11.cpp:3539
#30 0x00007fe301b19bc2 in x11EventSourceDispatch (s=0x11fb890, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#31 0x00007fe2ff752355 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007fe2ff752688 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007fe2ff752744 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#34 0x00007fe30051f276 in QEventDispatcherGlib::processEvents (this=0x11c7b30, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#35 0x00007fe301b1983e in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#36 0x00007fe3004ef8af in QEventLoop::processEvents (this=this@entry=0x7fffcdbb62f0, flags=...) at kernel/qeventloop.cpp:149
#37 0x00007fe3004efb38 in QEventLoop::exec (this=0x7fffcdbb62f0, flags=...) at kernel/qeventloop.cpp:204
#38 0x00007fe3004f4cf8 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1187
#39 0x00007fe3028e281d in kdemain (argc=<optimized out>, argv=0x7fffcdbb6800) at ../../../kate/app/katemain.cpp:377
#40 0x00007fe302570ead in __libc_start_main (main=<optimized out>, argc=<optimized out>, ubp_av=<optimized out>, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffcdbb68d8) at libc-start.c:228
#41 0x0000000000400761 in _start ()

Possible duplicates by query: bug 314245, bug 313628, bug 311866.

Reported using DrKonqi
Comment 1 Lisandro Damián Nicanor Pérez Meyer 2013-02-24 15:35:41 UTC
The complete sequence to type in to get it crashed (on a new document or the end of an existing document):

ia<enter>b<enter>c<enter><esc>v<up><shift>+d
Comment 2 Markus Raab 2013-02-24 18:27:20 UTC
I also created 2 unit tests:
DoTest("a\nb\nc\n", "jjjvkD", "a\nb");
DoTest("a\nb\nc\n", "jjjvBD", "a\nb");
Comment 3 Simon St James 2013-03-30 12:48:15 UTC
Thanks for the test, Markus - I used it to confirm that this is fixed in master, by the same commit that fixed bug 300296.  I'm marking it as a duplicate of that one, as although the symptoms don't match 100%, the cause was the same :)

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