3 thoughts on “Kate: Code Folding Crash

  1. 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.

  2. 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.

Comments are closed.

Scroll to top