Bug 320825

Summary: kate crashes when scrolling down after reload
Product: [Applications] kate Reporter: nfxjfg
Component: applicationAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: crash    
Priority: NOR    
Version: 3.10.2   
Target Milestone: ---   
Platform: Other   
OS: Other   
See Also: https://bugs.kde.org/show_bug.cgi?id=330221
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Saved backtrace from crash dialog
with debug infos

Description nfxjfg 2013-06-06 16:46:26 UTC
Please enter some 

Reproducible: Always

Steps to Reproduce:
1. Open some files contained in a git repo
2. Switch branches
3. Go to a file that is shorter in the new branch (maybe 2 pages of code instead of 2.5 or 3)
4. Click on the scrollbar slider and drag it down
5. kate crashes



This has been a problem for a long time, at least since 4.7.2, most likely older.
Comment 1 nfxjfg 2013-06-06 16:47:21 UTC
Created attachment 80348 [details]
Saved backtrace from crash dialog
Comment 2 Jekyll Wu 2013-06-06 17:24:09 UTC
> #8  0xb2b04b87 in ?? () from /usr/lib/libkatepartinterfaces.so.4

Please install debug symbols and try to provide a better backtrace.
Comment 3 nfxjfg 2013-06-06 17:59:00 UTC
Created attachment 80349 [details]
with debug infos
Comment 4 Dominik Haumann 2013-07-18 15:32:36 UTC
Always paste the backtrace, relevant parts:

Thread 1 (Thread 0xb5565a40 (LWP 866)):
[KCrash Handler]
#7  KateLineLayout::viewLineCount (this=0x0) at ../../part/render/katelinelayout.cpp:173
#8  0xb2b04b27 in KateLayoutCache::lastViewLine (this=0x84fefd0, realLine=-1) at ../../part/render/katelayoutcache.cpp:465
#9  0xb2b5cfc6 in KateViewInternal::viewLineOffset (this=this@entry=0x85014d0, virtualCursor=..., offset=offset@entry=45, keepX=keepX@entry=false) at ../../part/view/kateviewinternal.cpp:1313
#10 0xb2b5faa2 in KateViewInternal::scrollViewLines (this=this@entry=0x85014d0, offset=45) at ../../part/view/kateviewinternal.cpp:360
#11 0xb2b5fbd8 in KateViewInternal::scrollNextPage (this=0x85014d0) at ../../part/view/kateviewinternal.cpp:399
#12 0xb69934b2 in QMetaObject::activate (sender=sender@entry=0x8501f40, m=m@entry=0xb7deba40 <QAbstractSlider::staticMetaObject>, local_signal_index=local_signal_index@entry=5, argv=argv@entry=0xbfffe968) at kernel/qobject.cpp:3539
#13 0xb7b7de65 in QAbstractSlider::actionTriggered (this=this@entry=0x8501f40, _t1=_t1@entry=3) at .moc/release-shared/moc_qabstractslider.cpp:229
#14 0xb78843f7 in QAbstractSlider::triggerAction (this=0x8501f40, action=action@entry=QAbstractSlider::SliderPageStepAdd) at widgets/qabstractslider.cpp:630
#15 0xb7925024 in QScrollBarPrivate::activateControl (this=0x8501ff0, control=4, threshold=500) at widgets/qscrollbar.cpp:279
#16 0xb7926681 in QScrollBar::mousePressEvent (this=0x8501f40, e=0xbffff1e4) at widgets/qscrollbar.cpp:616
#17 0xb2b6cb2c in KateScrollBar::mousePressEvent (this=0x8501f40, e=0xbffff1e4) at ../../part/view/kateviewhelpers.cpp:196
#18 0xb74b80a6 in QWidget::event (this=0x8501f40, event=0xbffff1e4) at kernel/qwidget.cpp:8371
#19 0xb7884cd3 in QAbstractSlider::event (this=this@entry=0x8501f40, e=e@entry=0xbffff1e4) at widgets/qabstractslider.cpp:952
Comment 5 Dominik Haumann 2013-07-18 15:38:35 UTC
I cannot reproduce. Can you reproduce this please by running it in valgrind?
First build kate from sources ( http://kate-editor.org/get-it/ ), then call
./run.sh valgrind kate
and reproduce.
Comment 6 nfxjfg 2013-07-18 17:51:14 UTC
kate(20005)/kate-filetree KateFileTreePluginView::viewChanged: END!
ASSERT: "visibleLine >= 0" in file /tmp/kate/kate/part/buffer/katetextfolding.cpp, line 427
KCrash: Application 'kate' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
==20005== Invalid read of size 4
==20005==    at 0x48CA7EF: ??? (in /usr/lib/libkdeui.so.5.10.5)
==20005==    by 0x48CB1C0: ??? (in /usr/lib/libkdeui.so.5.10.5)
==20005==    by 0x48CBD58: KCrash::defaultCrashHandler(int) (in /usr/lib/libkdeui.so.5.10.5)
==20005==    by 0x5E578C7: ??? (in /lib/i386-linux-gnu/i686/cmov/libc-2.17.so)
==20005==  Address 0x15b7f650 is 0 bytes inside a block of size 3 alloc'd
==20005==    at 0x402B468: malloc (vg_replace_malloc.c:270)
==20005==    by 0x48CA776: ??? (in /usr/lib/libkdeui.so.5.10.5)
==20005==    by 0x48CB1C0: ??? (in /usr/lib/libkdeui.so.5.10.5)
==20005==    by 0x48CBD58: KCrash::defaultCrashHandler(int) (in /usr/lib/libkdeui.so.5.10.5)
==20005==    by 0x5E578C7: ??? (in /lib/i386-linux-gnu/i686/cmov/libc-2.17.so)
==20005==
Comment 7 nfxjfg 2013-07-18 18:03:12 UTC
By the way, this is pretty hard to reproduce. It appears you shouldn't have a view of the file opened, but it should still be opened in the background (i.e. it's on your list of opened files, but there is no window that shows the file contents). Then switch the branches two times: once to the version where the file is longer, then back to the version where it's shorter.  Then use the mouse and drag the scroll bar and pull it down, in a way that would scroll past the end of the file if it were possible.
Comment 8 Dominik Haumann 2013-08-09 12:13:11 UTC
Hm, can you again provide a normal backtrace with the self-built Kate? Because the initial backtrace is missing the assert in katetextfolding.cpp, so we don't have any concrete code path.
Comment 9 Dominik Haumann 2014-09-10 20:48:36 UTC
Do you still experience this problem?
Comment 10 nfxjfg 2014-09-10 21:17:59 UTC
I haven't experienced it in a while (though might be due to effective avoidance), and I couldn't reproduce it when I tested just now. Currently I'm on 3.14.0.

>Hm, can you again provide a normal backtrace with the self-built Kate? Because the initial backtrace is missing the assert in katetextfolding.cpp, so we don't have any concrete code path.

Sorry, must have missed this mail.