Bug 332523 - join lines will crash kate
Summary: join lines will crash kate
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: Vi Input Mode (show other bugs)
Version: 3.12.3
Platform: Fedora RPMs Linux
: NOR critical
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-24 16:49 UTC by wuchuanren
Modified: 2014-03-27 20:58 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.14


Attachments
a test file for the bug, join at the first line will cause crash (153 bytes, text/x-tex)
2014-03-24 16:49 UTC, wuchuanren
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wuchuanren 2014-03-24 16:49:37 UTC
Created attachment 85718 [details]
a test file for the bug, join at the first line will cause crash

How to reproduce the bug:

1. enable the vim mode
2. set wrap width 80 and enable line wrapping (I have all tabs as 2 spaces, do not know, if this matters by reproducing the bug)
3. create a file with the following content (two lines, the test file can be found in the attachment):
        aaaaaaaaa aaa aa aaaa aaaaaaaa aaaaa aa aaaaaa aa aaa a aaaaaaa
aaaaaaaaa aaaaaaaa aaaaaaaaaaa aa aaaa aaaaa aaa aaaaaaa aaaaaaaaa        aaaaaa
4. press 'J' at the first line to join the two lines
5. it crashes
Comment 1 Miquel Sabaté 2014-03-24 17:13:54 UTC
I can reproduce this bug with the attached document. I can reproduce this crash regardless of the indentation settings. I'll take a look at it as soon as possible. Here's the generated bactrace:

Application: KWrite (kwrite), signal: Aborted
Using host libthread_db library "/usr/lib/libthread_db.so.1".
To enable execution of this file add
	add-auto-load-safe-path /usr/lib/libstdc++.so.6.0.19-gdb.py
line to your configuration file "/home/mssola/.gdbinit".
To completely disable this security protection add
	set auto-load safe-path /
line to your configuration file "/home/mssola/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
	info "(gdb)Auto-loading safe path"
[Current thread is 1 (Thread 0x7f3b97fa6780 (LWP 19993))]

Thread 2 (Thread 0x7f3b8435f700 (LWP 19994)):
#0  0x00007f3b9416904f in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
#1  0x00007f3b8528cfcb in ?? () from /usr/lib/libQtScript.so.4
#2  0x00007f3b8528d009 in ?? () from /usr/lib/libQtScript.so.4
#3  0x00007f3b941650a2 in start_thread () from /usr/lib/libpthread.so.0
#4  0x00007f3b93404d1d in clone () from /usr/lib/libc.so.6

Thread 1 (Thread 0x7f3b97fa6780 (LWP 19993)):
[KCrash Handler]
#5  0x00007f3b93354389 in raise () from /usr/lib/libc.so.6
#6  0x00007f3b93355788 in abort () from /usr/lib/libc.so.6
#7  0x00007f3b943ea90f in qt_message_output(QtMsgType, char const*) () from /usr/lib/libQtCore.so.4
#8  0x00007f3b943eaa99 in ?? () from /usr/lib/libQtCore.so.4
#9  0x00007f3b943eb2a4 in qFatal(char const*, ...) () from /usr/lib/libQtCore.so.4
#10 0x00007f3b84ce2a50 in KSharedPtr<KateLineLayout>::operator-> (this=0x7fffb3139690) at /usr/include/ksharedptr.h:126
#11 0x00007f3b84ce7a0c in KateLayoutCache::textLayout (this=0xf84e40, realCursor=...) at /home/mssola/Projects/kde/kate/part/render/katelayoutcache.cpp:344
#12 0x00007f3b84d416dd in KateViewInternal::updateCursor (this=0x102f480, newCursor=..., force=false, center=false, calledExternally=false) at /home/mssola/Projects/kde/kate/part/view/kateviewinternal.cpp:1920
#13 0x00007f3b84d70db4 in KateViModeBase::updateCursor (this=0x1229490, c=...) at /home/mssola/Projects/kde/kate/part/vimode/katevimodebase.cpp:930
#14 0x00007f3b84d7a6d7 in KateViNormalMode::commandJoinLines (this=0x1229490) at /home/mssola/Projects/kde/kate/part/vimode/katevinormalmode.cpp:1127
#15 0x00007f3b84d94e44 in KateViCommand::execute (this=0xee95e0) at /home/mssola/Projects/kde/kate/part/vimode/katevicommand.cpp:38
#16 0x00007f3b84d77e16 in KateViNormalMode::executeCommand (this=0x1229490, cmd=0xee95e0) at /home/mssola/Projects/kde/kate/part/vimode/katevinormalmode.cpp:515
#17 0x00007f3b84d779ff in KateViNormalMode::handleKeypress (this=0x1229490, e=0x7fffb313a510) at /home/mssola/Projects/kde/kate/part/vimode/katevinormalmode.cpp:429
#18 0x00007f3b84d63a2c in KateViInputModeManager::handleKeypress (this=0x1229320, e=0x7fffb313a510) at /home/mssola/Projects/kde/kate/part/vimode/kateviinputmodemanager.cpp:162
#19 0x00007f3b84d43e4c in KateViewInternal::keyPressEvent (this=0x102f480, e=0x7fffb313a510) at /home/mssola/Projects/kde/kate/part/view/kateviewinternal.cpp:2347
#20 0x00007f3b84d4359b in KateViewInternal::eventFilter (this=0x102f480, obj=0x102f480, e=0x7fffb313a510) at /home/mssola/Projects/kde/kate/part/view/kateviewinternal.cpp:2235
#21 0x00007f3b944f5026 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#22 0x00007f3b956840bc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#23 0x00007f3b9568b8f1 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#24 0x00007f3b963a388a in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#25 0x00007f3b944f4ebd in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#26 0x00007f3b84d4cbe3 in QCoreApplication::sendEvent (receiver=0x102f480, event=0x7fffb313a510) at /usr/include/qt4/QtCore/qcoreapplication.h:231
#27 0x00007f3b84d643d6 in KateViInputModeManager::feedKeyPresses (this=0x1229320, keyPresses=...) at /home/mssola/Projects/kde/kate/part/vimode/kateviinputmodemanager.cpp:262
#28 0x00007f3b84db89e0 in KateViKeyMapper::playBackRejectedKeys (this=0x1233e80) at /home/mssola/Projects/kde/kate/part/vimode/katevikeymapper.cpp:64
#29 0x00007f3b84db8d45 in KateViKeyMapper::handleKeypress (this=0x1233e80, key=...) at /home/mssola/Projects/kde/kate/part/vimode/katevikeymapper.cpp:123
#30 0x00007f3b84d638bd in KateViInputModeManager::handleKeypress (this=0x1229320, e=0x7fffb313af00) at /home/mssola/Projects/kde/kate/part/vimode/kateviinputmodemanager.cpp:140
#31 0x00007f3b84d43e4c in KateViewInternal::keyPressEvent (this=0x102f480, e=0x7fffb313af00) at /home/mssola/Projects/kde/kate/part/view/kateviewinternal.cpp:2347
#32 0x00007f3b84d4359b in KateViewInternal::eventFilter (this=0x102f480, obj=0x102f480, e=0x7fffb313af00) at /home/mssola/Projects/kde/kate/part/view/kateviewinternal.cpp:2235
#33 0x00007f3b944f5026 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#34 0x00007f3b956840bc in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#35 0x00007f3b9568b8f1 in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#36 0x00007f3b963a388a in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#37 0x00007f3b944f4ebd in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#38 0x00007f3b9571e659 in ?? () from /usr/lib/libQtGui.so.4
#39 0x00007f3b9571e9f9 in ?? () from /usr/lib/libQtGui.so.4
#40 0x00007f3b956fa96f in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/libQtGui.so.4
#41 0x00007f3b95721162 in ?? () from /usr/lib/libQtGui.so.4
#42 0x00007f3b9074b296 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#43 0x00007f3b9074b5e8 in ?? () from /usr/lib/libglib-2.0.so.0
#44 0x00007f3b9074b68c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#45 0x00007f3b94521b25 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#46 0x00007f3b95721216 in ?? () from /usr/lib/libQtGui.so.4
#47 0x00007f3b944f3b1f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#48 0x00007f3b944f3e15 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#49 0x00007f3b944f8f4b in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#50 0x00007f3b97bd1608 in kdemain (argc=2, argv=0x7fffb313c418) at /home/mssola/Projects/kde/kate/kwrite/kwritemain.cpp:739
#51 0x00000000004008df in main (argc=2, argv=0x7fffb313c418) at /home/mssola/Projects/kde/kate/build/kwrite/kwrite_dummy.cpp:3
Comment 2 Miquel Sabaté 2014-03-24 20:25:05 UTC
Git commit b85017fc3ea5ded616450b0afa0e8c2165384b5d by Miquel Sabaté.
Committed on 24/03/2014 at 20:15.
Pushed by mssola into branch 'master'.

vimode: fixed crash when joining lines that do not fit a static word wrap.
Related: bug 331021
REVIEW: 117029
FIXED-IN: 4.12.4

M  +1    -2    part/vimode/katevinormalmode.cpp
M  +7    -0    tests/vimode_test.cpp

http://commits.kde.org/kate/b85017fc3ea5ded616450b0afa0e8c2165384b5d
Comment 3 Miquel Sabaté 2014-03-24 20:49:29 UTC
Git commit 02cdf4e9b795390b97e672512232bd324f1b54cc by Miquel Sabaté.
Committed on 24/03/2014 at 20:48.
Pushed by mssola into branch 'master'.

vimode: fixed crash when joining lines that do not fit a static word wrap.
Related: bug 331021
REVIEW: 117029

M  +7    -0    autotests/src/vimode_test.cpp
M  +1    -1    src/vimode/katevinormalmode.cpp

http://commits.kde.org/ktexteditor/02cdf4e9b795390b97e672512232bd324f1b54cc
Comment 4 Christoph Feck 2014-03-27 20:58:44 UTC
I do not see the commits above in the 4.12 or 4.13 branch, only in master. I cannot decide if this can be backported.