fix: remove startup key monitor in defer so it can't leak#101
Open
gi11es wants to merge 2 commits into
Open
Conversation
The +0.3s initial-input closure early-returned before removing the window-wide keystroke-swallowing NSEvent monitor when pendingInitialInput was nil. A leaked monitor silently eats every keystroke for the window whenever the surface's view is attached. Move monitor removal (and handlesPasteShortcuts restore) into defer. Found while investigating #99. Co-Authored-By: Claude Fable 5 <[email protected]>
- remove any existing monitor before installing a new one (overwrite orphaned the old token inside AppKit) - the delayed closure now removes only the monitor it installed, gated on identity, so it can never remove a later call's monitor or double-remove one terminate() already handled - add deinit backstop for surfaces released without terminate() - clear pendingInitialInput in terminate() so a tab closed inside the 0.3s window doesn't send its initial command to a dead PTY Co-Authored-By: Claude Fable 5 <[email protected]>
Owner
Author
|
Subagent review follow-up (pushed): the original defer fix guarded a path that's currently unreachable — the real leak vectors were (1) overwriting |
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.
The +0.3s initial-input closure in
TerminalSurface.startShellearly-returned before removing the window-wide keystroke-swallowingNSEventmonitor whenpendingInitialInputwas nil. A leaked monitor silently eats every keystroke for the window whenever the surface's view is attached (latent bug surfaced by the #99 investigation — ruled out as that freeze's cause by live state inspection, but real).Fix: move monitor removal and
handlesPasteShortcutsrestore into a singledeferso every exit path cleans up.🤖 Generated with Claude Code