Conversation
7 tasks
Contributor
✅ Code Coverage: 70.3%Threshold: 70% Coverage is above the minimum threshold. Generated by CI — see job summary for detailed file-level breakdown. |
batonogov
commented
Mar 29, 2026
Owner
Author
batonogov
left a comment
There was a problem hiding this comment.
APPROVE. isUndoRedoInProgress корректно сбрасывается (в textDidChange + в deferred workItem). scheduleDeferredHighlight вынесен в общий метод. Реальный undo тест через undoManager.undo() присутствует. Двойная защита в SyntaxHighlighter (resetAttributes + applyMatches).
Race condition between undo manager and async syntax highlighting: when undo/redo modifies NSTextStorage, the debounced highlighting could also call beginEditing/endEditing on the same textStorage, causing concurrent mutation and EXC_BAD_ACCESS. Fix: detect isUndoing/isRedoing in textDidChange and defer syntax highlighting until the undo manager completes. Also add guards in SyntaxHighlighter.applyMatches() and resetAttributes() to bail out if called during an active undo/redo operation.
…ighlight, real undo test
c34e7cc to
69c8b16
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes critical crash (EXC_BAD_ACCESS in objc_msgSend) when pressing Cmd+Z.
Root cause: undo manager modifies textStorage → textDidChange fires → debounced highlighting calls beginEditing/endEditing on same textStorage simultaneously → crash.
Fix: skip/defer syntax highlighting when
undoManager.isUndoing || isRedoing.Closes #650
Test plan