Prevent parent-routed keyDown re-entry#49
Merged
satoshi-szk merged 3 commits intoJul 4, 2026
Merged
Conversation
Some plugin hosts can synchronously bounce a parent-routed keyDown back into the embedded WebView while the original event is still being forwarded. Guarding only that nested dispatch preserves the first host delivery and avoids AppKit recursion that can overflow the main thread stack.
The guard is intentionally narrow, so reviewers and future changes need to understand that it suppresses only synchronous host bounce-back while preserving the first parent-routed event for host shortcuts.
The re-entry guard must only suppress child-wrapper bounce-back. Window WebViews route their first parent delivery to the wrapper itself, so treating every guarded wrapper call as re-entry drops existing parent keyboard routing.
satoshi-szk
marked this pull request as ready for review
July 4, 2026 14:22
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
Why
A local REAPER crash report from 2026-07-04 showed the main thread failing with
EXC_BAD_ACCESS/SIGSEGVandThread stack size exceeded due to excessive recursion. The faulting stack repeatedly involvedREAPERSwell_hwnd keyDown,WryWebViewParent::key_down,WKWebView _web_superKeyDown, andWryWebView::key_down, which indicates a host/WebView keyDown bounce while forwarding an event to the parent.The guard is scoped to the synchronous parent-forwarding window so host shortcuts such as Space still receive the first event, while recursive re-entry is treated as handled.
Validation
cargo fmt --checkcargo check -p wryNote:
cargo fmt --checkstill prints the existing stable-rustfmt warning forimports_granularity = Crate, andcargo check -p wrystill prints pre-existing deprecation / unnecessary-unsafe warnings.