https://bugs.kde.org/show_bug.cgi?id=528753

Christoph Cullmann <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Latest Commit|                            |https://invent.kde.org/fram
                   |                            |eworks/syntax-highlighting/
                   |                            |-/commit/914907a6e41c01c61e
                   |                            |d78d1ca20242bf08b5695b
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #3 from Christoph Cullmann <[email protected]> ---
Git commit 914907a6e41c01c61ed78d1ca20242bf08b5695b by Christoph Cullmann, on
behalf of Reda Hilal.
Committed on 15/11/2026 at 10:47.
Pushed by cullmann into branch 'master'.

SyntaxHighlighter: don't queue a QTextBlock for re-highlighting

When the end state or folding regions of a block change, highlightBlock()
queues a re-highlight of the next block. It passed that block to the queued
call as a QTextBlock, which is only an index into the document's block map.
If the text is replaced before the call is delivered, for example with
setPlainText() right after a definition change, the block is stale:
QSyntaxHighlighter::rehighlightBlock() still accepts it, and
QTextBlock::position() reads past the new block map and crashes.

Queue the block number instead and look the block up when the call runs.
If the document changed in between, the worst case is re-highlighting a
block that did not need it.

M  +5    -0    autotests/CMakeLists.txt
A  +121  -0    autotests/syntaxhighlighter_test.cpp     [License: MIT]
M  +13   -1    src/lib/syntaxhighlighter.cpp

https://invent.kde.org/frameworks/syntax-highlighting/-/commit/914907a6e41c01c61ed78d1ca20242bf08b5695b

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to