Thursday, June 10, 2010

Kate: Code Folding Crash

We still have a crash in Kate's code folding code; no one was able to find a proper fix, yet. So if you want to get your hands dirty, just build Kate, find a fix and be the hero of all Kate developers :)

Update: Fixed by Stefan Schenk in this commit for KDE 4.5. Awesome! :)


Christoph Bartoschek said...

The bug can easily be explained:

cleanupUnneededNodes is called recursively.

cleanupUnneededNodes -> removeOpening -> toggleRegionVisibility -> ensureHighlighted -> doHighlight -> updateLine -> cleanupUnneededNodes

While you are in removeOpening for a node the node is deleted in the second call to cleanupUnneededNodes. When removeOpening then proceeds it accesses the deleted node.

Christoph Bartoschek said...

Maybe the problem starts when doHighlight is called recursively.

Anonymous said...

The recursion is only part of the problem.
I already prevented it, but that won't work, as the tree relies on the fact that the highlighting is up to date until end of regions. If you avoid recursion, for example by changing the ensureHighlighted call or guard it internally, the code just crashs somewhere else because the tree is borked.
It must be changed, that ensureHighlighted is needed and it must be avoided that other stuff is triggered that requires hl information for lines > the current one.