Bug 294756

Summary: crash in code folding
Product: [Applications] kate Reporter: Dominik Haumann <dhaumann>
Component: foldingAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: adrian.lungu89, emarcotte, kcraj2
Priority: VHI    
Version: SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Python file for reproducing the crash
valgrind trace

Description Dominik Haumann 2012-02-24 16:15:02 UTC
Created attachment 69065 [details]
Python file for reproducing the crash

Version:           SVN (using KDE 4.8.0) 
OS:                Linux

load the attached python file, and make sure highlighting is enabled.


Reproducible: Always

Steps to Reproduce:
1. fold all with ctrl+-
2. move the cursor with the "arrow down" key down to line 8
3. press "arrow left" key (2nd fold unfolds)
4. press backspace -> crash


Expected Results:  
It should not crash.
Comment 1 Dominik Haumann 2012-02-24 16:16:22 UTC
Created attachment 69066 [details]
valgrind trace
Comment 2 Dominik Haumann 2012-02-24 16:18:15 UTC
Thread 1 (Thread 0xb5008710 (LWP 8640)):
[KCrash Handler]
#7  0xb24e2b84 in KateCodeFoldingNode::setParent (this=0x84abe00) at part/syntax/katecodefolding.cpp:340
#8  0xb24e2fa7 in KateCodeFoldingNode::updateSelf (this=0x84abe00) at part/syntax/katecodefolding.cpp:439
#9  0xb24e3b56 in KateCodeFoldingTree::deleteEndNode (this=0x8292700, deletedNode=0x84abfd0) at part/syntax/katecodefolding.cpp:619
#10 0xb24e883a in KateCodeFoldingTree::deleteNode (this=0x8292700, deletedNode=0x84abfd0) at part/syntax/katecodefolding.h:353
#11 0xb24e70cf in KateCodeFoldingTree::updateMapping (this=0x8292700, line=11, newColumns=..., virtualNodeIndex=-1, virtualColumn=0) at part/syntax/katecodefolding.cpp:1582
#12 0xb24e6cf9 in KateCodeFoldingTree::updateLine (this=0x8292700, line=11, regionChanges=..., updated=0xbfcc25f7, changed=true, colsChanged=false) at part/syntax/katecodefolding.cpp:1508
#13 0xb247a070 in KateBuffer::doHighlight (this=0x8292678, startLine=7, endLine=16, invalidate=false) at part/document/katebuffer.cpp:706
#14 0xb2478f30 in KateBuffer::ensureHighlighted (this=0x8292678, line=7) at part/document/katebuffer.cpp:250
#15 0xb246a3e0 in KateDocument::kateTextLine (this=0x8291fc8, i=7) at part/document/katedocument.cpp:4786
#16 0xb24b0096 in KateLineLayout::textLine (this=0x84dd920, reloadForce=true) at part/render/katelinelayout.cpp:67
#17 0xb24abf7b in KateLayoutCache::line (this=0x8297430, realLine=7, virtualLine=6) at part/render/katelayoutcache.cpp:298
#18 0xb2505ca1 in KateViewInternal::viewLineOffset (this=0x82bc0c8, virtualCursor=..., offset=32, keepX=false) at part/view/kateviewinternal.cpp:1327
#19 0xb2502bbd in KateViewInternal::makeVisible (this=0x82bc0c8, c=..., endCol=9, force=false, center=false, calledExternally=false) at part/view/kateviewinternal.cpp:619
#20 0xb2508a5c in KateViewInternal::updateCursor (this=0x82bc0c8, newCursor=..., force=true, center=false, calledExternally=false) at part/view/kateviewinternal.cpp:1844
#21 0xb2503211 in KateViewInternal::slotRegionVisibilityChanged (this=0x82bc0c8) at part/view/kateviewinternal.cpp:674
#22 0xb25002b3 in KateViewInternal::qt_metacall (this=0x82bc0c8, _c=QMetaObject::InvokeMetaMethod, _id=16, _a=0xbfcc2cec) at build/part/kateviewinternal.moc:130
#23 0xb5f948ad in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#24 0xb5fa4a0c in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#25 0xb23f1605 in KateCodeFoldingTree::regionVisibilityChanged (this=0x8292700) at build/part/moc_katecodefolding.cpp:121
#26 0xb24e68b0 in KateCodeFoldingTree::unfoldNode (this=0x8292700, node=0x84abca8) at part/syntax/katecodefolding.cpp:1412
#27 0xb24e3a94 in KateCodeFoldingTree::deleteNodeFromMap (this=0x8292700, node=0x84abca8) at part/syntax/katecodefolding.cpp:601
#28 0xb24e3b99 in KateCodeFoldingTree::deleteStartNode (this=0x8292700, deletedNode=0x84abca8) at part/syntax/katecodefolding.cpp:630
#29 0xb24e8826 in KateCodeFoldingTree::deleteNode (this=0x8292700, deletedNode=0x84abca8) at part/syntax/katecodefolding.h:353
#30 0xb24e70cf in KateCodeFoldingTree::updateMapping (this=0x8292700, line=8, newColumns=..., virtualNodeIndex=-1, virtualColumn=0) at part/syntax/katecodefolding.cpp:1582
#31 0xb24e6cf9 in KateCodeFoldingTree::updateLine (this=0x8292700, line=8, regionChanges=..., updated=0xbfcc2f07, changed=true, colsChanged=false) at part/syntax/katecodefolding.cpp:1508
#32 0xb247a070 in KateBuffer::doHighlight (this=0x8292678, startLine=7, endLine=16, invalidate=false) at part/document/katebuffer.cpp:706
#33 0xb2478f30 in KateBuffer::ensureHighlighted (this=0x8292678, line=7) at part/document/katebuffer.cpp:250
#34 0xb246a3e0 in KateDocument::kateTextLine (this=0x8291fc8, i=7) at part/document/katedocument.cpp:4786
#35 0xb24b0096 in KateLineLayout::textLine (this=0x8425080, reloadForce=true) at part/render/katelinelayout.cpp:67
#36 0xb24abf7b in KateLayoutCache::line (this=0x8297430, realLine=7, virtualLine=6) at part/render/katelayoutcache.cpp:298
#37 0xb24abd46 in KateLayoutCache::updateViewCache (this=0x8297430, startPos=..., newViewLineCount=34, viewLinesScrolled=0) at part/render/katelayoutcache.cpp:270
#38 0xb25096ee in KateViewInternal::tagLines (this=0x82bc0c8, start=..., end=..., realCursors=true) at part/view/kateviewinternal.cpp:1975
#39 0xb25094ba in KateViewInternal::tagLines (this=0x82bc0c8, start=5, end=16, realLines=true) at part/view/kateviewinternal.cpp:1945
#40 0xb24f9653 in KateView::tagLines (this=0x8296be8, start=5, end=16, realLines=true) at part/view/kateview.cpp:1682
#41 0xb246348f in KateDocument::tagLines (this=0x8291fc8, start=5, end=16) at part/document/katedocument.cpp:3615
#42 0xb2450ccc in KateDocument::qt_metacall (this=0x8291fc8, _c=QMetaObject::InvokeMetaMethod, _id=51, _a=0xbfcc3494) at build/part/katedocument.moc:350
#43 0xb5f948ad in QMetaObject::metacall(QObject*, QMetaObject::Call, int, void**) () from /usr/lib/libQtCore.so.4
#44 0xb5fa4a0c in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#45 0xb24783e3 in KateBuffer::tagLines (this=0x8292678, _t1=5, _t2=16) at build/part/katebuffer.moc:98
#46 0xb247a1dc in KateBuffer::doHighlight (this=0x8292678, startLine=5, endLine=7, invalidate=true) at part/document/katebuffer.cpp:736
#47 0xb247869e in KateBuffer::editEnd (this=0x8292678) at part/document/katebuffer.cpp:122
#48 0xb245621e in KateDocument::editEnd (this=0x8291fc8) at part/document/katedocument.cpp:854
#49 0xb2455c5f in KateDocument::removeText (this=0x8291fc8, _range=..., block=false) at part/document/katedocument.cpp:731
#50 0xb245f30d in KateDocument::backspace (this=0x8291fc8, view=0x8296be8, c=...) at part/document/katedocument.cpp:2794
#51 0xb2503eb7 in KateViewInternal::doBackspace (this=0x82bc0c8) at part/view/kateviewinternal.cpp:799
#52 0xb24fc50f in KateView::backspace (this=0x8296be8) at part/view/kateview.cpp:2304
#53 0xb24ebc66 in KateView::qt_metacall (this=0x8296be8, _c=QMetaObject::InvokeMetaMethod, _id=49, _a=0xbfcc3918) at
Comment 3 Dominik Haumann 2012-02-24 17:54:38 UTC
Pushed by dhaumann into branch 'master'.

unit test for folding crash 294756

M  +11   -0    part/tests/CMakeLists.txt
M  +1    -1    part/tests/bug294241.cpp
M  +1    -1    part/tests/bug294241.h
C  +18   -46   part/tests/bug294756.cpp [from: part/tests/bug294241.cpp - 055% similarity]
C  +4    -5    part/tests/bug294756.h [from: part/tests/bug294241.h - 086% similarity]
A  +17   -0    part/tests/folding-crash.py

http://commits.kde.org/kate/b011cf92d09bfaa8819e1219881a2c4711c41660
Comment 4 Dominik Haumann 2012-03-16 18:53:35 UTC
Git commit 7f25a94366136af22b328d3a8831431585d9f647 by Dominik Haumann.
Committed on 16/03/2012 at 19:51.
Pushed by dhaumann into branch 'master'.

fix crash: no double deletion any more
Related: bug 294750

M  +34   -8    part/syntax/katecodefolding.cpp

http://commits.kde.org/kate/7f25a94366136af22b328d3a8831431585d9f647
Comment 5 Dominik Haumann 2012-03-20 18:34:17 UTC
Git commit 317755347b1f93ae06eb71dae663b1b60511913a by Dominik Haumann.
Committed on 16/03/2012 at 19:51.
Pushed by dhaumann into branch 'KDE/4.8'.

fix crash: no double deletion any more
Related: bug 294750

M  +34   -8    part/syntax/katecodefolding.cpp

http://commits.kde.org/kate/317755347b1f93ae06eb71dae663b1b60511913a
Comment 6 Dominik Haumann 2012-03-29 17:10:44 UTC
*** Bug 296748 has been marked as a duplicate of this bug. ***
Comment 7 Dominik Haumann 2012-04-03 21:14:28 UTC
*** Bug 297371 has been marked as a duplicate of this bug. ***