Bug 265985

Summary: kate crashes when doing regexp search & replace (Replace All) on large file (KateLineLayout::viewLineCount (this=0x0))
Product: [Applications] kate Reporter: Peter Schübel <peter.schuebel>
Component: partAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: crash CC: christoph, pierigno
Priority: VHI Keywords: triaged
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Peter Schübel 2011-02-10 15:21:44 UTC
Application: kate (3.4.4)
KDE Platform Version: 4.4.4 (KDE 4.4.4) "release 3"
Qt Version: 4.6.3
Operating System: Linux 2.6.34.7-0.7-default x86_64
Distribution: "openSUSE 11.3 (x86_64)"

-- Information about the crash:
Steps:
- opened kate, loaded the file (10 KByte).
- pressed Ctrl+R to open search & replace
- selected Regular Expressions, entered following regexp:
\n\s*objpos.*\n
- entered following replace text (a single comma, no whitespace):
,
- crash happens

The crash can be reproduced every time.

 -- Backtrace:
Application: Kate (kdeinit4), signal: Segmentation fault
[KCrash Handler]
#5  KateLineLayout::viewLineCount (this=0x0) at /usr/src/debug/kdelibs-4.4.4/kate/render/katelinelayout.cpp:173
#6  0x00007f5ef5dfaa29 in KateLayoutCache::viewLine (this=0xa3f5e0, realCursor=...) at /usr/src/debug/kdelibs-4.4.4/kate/render/katelayoutcache.cpp:395
#7  0x00007f5ef5e4f791 in KateViewInternal::viewLineOffset (this=0x9902b0, virtualCursor=..., offset=38, keepX=false) at /usr/src/debug/kdelibs-4.4.4/kate/view/kateviewinternal.cpp:1352
#8  0x00007f5ef5e520cc in KateViewInternal::makeVisible (this=0x9902b0, c=..., endCol=603, force=false, center=<value optimized out>, calledExternally=false)
    at /usr/src/debug/kdelibs-4.4.4/kate/view/kateviewinternal.cpp:667
#9  0x00007f5ef5e56321 in KateViewInternal::updateCursor (this=0x9902b0, newCursor=<value optimized out>, force=<value optimized out>, center=false, calledExternally=false)
    at /usr/src/debug/kdelibs-4.4.4/kate/view/kateviewinternal.cpp:1915
#10 0x00007f5ef5e563f9 in KateViewInternal::editEnd (this=0x9902b0, editTagLineStart=<value optimized out>, editTagLineEnd=<value optimized out>, tagFrom=<value optimized out>)
    at /usr/src/debug/kdelibs-4.4.4/kate/view/kateviewinternal.cpp:3400
#11 0x00007f5ef5dc6f21 in KateDocument::editEnd (this=0x8c6280) at /usr/src/debug/kdelibs-4.4.4/kate/document/katedocument.cpp:981
#12 0x00007f5ef5e065a1 in KateSearchBar::findAll (this=0x128ed60, inputRange=<incomplete type>, replacement=0x7fff206e81a0) at /usr/src/debug/kdelibs-4.4.4/kate/search/katesearchbar.cpp:999
#13 0x00007f5ef5e06a39 in KateSearchBar::onPowerReplaceAll (this=0x128ed60) at /usr/src/debug/kdelibs-4.4.4/kate/search/katesearchbar.cpp:1030
#14 0x00007f5ef5e0c243 in KateSearchBar::qt_metacall (this=0x128ed60, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff206e8300)
    at /usr/src/debug/kdelibs-4.4.4/build/kate/katesearchbar.moc:124
#15 0x00007f5f07008a1f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib64/libQtCore.so.4
#16 0x00007f5f0681f082 in QAbstractButton::clicked(bool) () from /usr/lib64/libQtGui.so.4
#17 0x00007f5f0656a68b in ?? () from /usr/lib64/libQtGui.so.4
#18 0x00007f5f0656ba3b in ?? () from /usr/lib64/libQtGui.so.4
#19 0x00007f5f0656bcac in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () from /usr/lib64/libQtGui.so.4
#20 0x00007f5f06219dbc in QWidget::event(QEvent*) () from /usr/lib64/libQtGui.so.4
#21 0x00007f5f061c94d4 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#22 0x00007f5f061d234a in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQtGui.so.4
#23 0x00007f5f07480c06 in KApplication::notify(QObject*, QEvent*) () from /usr/lib64/libkdeui.so.5
#24 0x00007f5f06ff4e4c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib64/libQtCore.so.4
#25 0x00007f5f061cb1e5 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib64/libQtGui.so.4
#26 0x00007f5f062456c8 in ?? () from /usr/lib64/libQtGui.so.4
#27 0x00007f5f06243e19 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib64/libQtGui.so.4
#28 0x00007f5f0626a492 in ?? () from /usr/lib64/libQtGui.so.4
#29 0x00007f5f0226da93 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#30 0x00007f5f0226e270 in ?? () from /usr/lib64/libglib-2.0.so.0
#31 0x00007f5f0226e510 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#32 0x00007f5f0701d67f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#33 0x00007f5f0626a14e in ?? () from /usr/lib64/libQtGui.so.4
#34 0x00007f5f06ff4292 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#35 0x00007f5f06ff4495 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib64/libQtCore.so.4
#36 0x00007f5f06ff888b in QCoreApplication::exec() () from /usr/lib64/libQtCore.so.4
#37 0x00007f5ef8c1f12d in kdemain (argc=1, argv=0x67e120) at /usr/src/debug/kdesdk-4.4.4/kate/app/katemain.cpp:377
#38 0x0000000000407659 in launch (argc=2, _name=0x69a9e8 "/usr/bin/kate", args=<value optimized out>, cwd=0x0, envc=<value optimized out>, envs=<value optimized out>, reset_env=false, tty=0x0, 
    avoid_loops=false, startup_id_str=0x69aa16 "vp52;1297346996;969649;17576_TIME1742257632") at /usr/src/debug/kdelibs-4.4.4/kinit/kinit.cpp:718
#39 0x0000000000408175 in handle_launcher_request (sock=8, who=<value optimized out>) at /usr/src/debug/kdelibs-4.4.4/kinit/kinit.cpp:1210
#40 0x00000000004088ea in handle_requests (waitForPid=<value optimized out>) at /usr/src/debug/kdelibs-4.4.4/kinit/kinit.cpp:1403
#41 0x000000000040953e in main (argc=4, argv=0x7fff206ebff8, envp=0x7fff206ec020) at /usr/src/debug/kdelibs-4.4.4/kinit/kinit.cpp:1882

Possible duplicates by query: bug 252520, bug 238887, bug 238394, bug 235046, bug 234364.

Reported using DrKonqi
Comment 1 Dominik Haumann 2011-07-22 18:16:22 UTC
Peter: Can you please attach the file, so that we can reproduce as well? This is really important. There are several other bug reports with a similar crash, but it always happens randomly. So having a way to reproduce would help immensely to solve this issue!
Comment 2 Dominik Haumann 2011-08-09 14:10:39 UTC
Although some of the bugs were due to folding, this looks like another issue:
In KateLineLayout, m_layout pointer is 0x0. With setLayout() and invalidateLayout() m_layout is set to 0x0. So maybe this is called somehow, and then KateLineLayout::viewLineCount( ) is called that accesses the m_layout without check.

In KateLineLayout::viewLine( int viewLine ), there is even a call
  Q_ASSERT(isValid());
and isValid() checks m_layout().

So question is why the layout is 0, this seems to be wrong...
Comment 3 pierigno 2012-01-24 17:04:04 UTC
I think the problem is due to a wrong management of large sequence of non-blank character. Try for example to select all the text of this non-formatted rss file:

http://pkg.sabayon.org/standard/sabayon-limbo/database/x86/5/updates.rss

Here, on a core i7 with 6Gb of ram, kate makes the whole system slugghish and unresponsive, until you tell kate to indent it.
Comment 4 Christoph Cullmann 2012-10-27 00:10:34 UTC
If it is the "large line" problem, we can't fix that, this is an qt issue. We need to layout the whole line. Therefore closing, if somebody provides way to reproduce, we can look again at this. 100KB files or co seem no problem for me, but slow.
Comment 5 Andrew Crouthamel 2018-09-23 02:19:33 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information as soon as possible and set the bug status as REPORTED. Due to regular bug tracker maintenance, if the bug is still in NEEDSINFO status with no change in 30 days, the bug will be closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please set the bug status as REPORTED so that the KDE team knows that the bug is ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 6 Andrew Crouthamel 2018-10-27 04:18:03 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least 30 days. The bug is now closed as RESOLVED > WORKSFORME due to lack of needed information.

For more information about our bug triaging procedures please read the wiki located here: https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!