Fix GPUI crash when using cached view with Input#50665
Merged
mikayla-maki merged 2 commits intoMay 14, 2026
Merged
Conversation
Contributor
Author
|
The 4 test failures (agent_ui, vim) are unrelated to this change — this PR only modifies crates/gpui/src/window.rs. These appear to be pre-existing flaky tests. Could you re-trigger CI? Thanks! |
The draw() method was calling .pop() on next_frame.input_handlers to extract the active input handler for the platform window. This reduced the Vec length, making cached paint_range indices stale. On the next frame, when a cached view called reuse_paint(), it would index into rendered_frame.input_handlers with out-of-bounds indices, causing a panic: 'range start index 1 out of range for slice of length 0'. Fix: Use .last_mut().and_then(|h| h.take()) instead of .pop() to extract the handler without changing the Vec length. The slot becomes None, which is already handled by reuse_paint's .take() logic.
b4b2b40 to
ffb03fb
Compare
Contributor
Author
|
Hi, the PR is ready for review. |
Contributor
Author
|
Hi @mikayla-maki, is this PR ready for merge ? |
1 similar comment
Contributor
Author
|
Hi @mikayla-maki, is this PR ready for merge ? |
This was referenced May 27, 2026
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
draw()method was calling.pop()onnext_frame.input_handlersto extract the active input handler for the platform window. This reduced the Vec length, making cachedpaint_rangeindices stale. On the next frame, when a cached view calledreuse_paint(), it would index intorendered_frame.input_handlerswith out-of-bounds indices, causing a panic:range start index 1 out of range for slice of length 0.Fix: Use
.last_mut().and_then(|h| h.take())instead of.pop()to extract the handler without changing the Vec length. The slot becomesNone, which is already handled byreuse_paint's.take()logic.Closes #50456
Testing
cargo run --example dock:Before you mark this PR as ready for review, make sure that you have:
Release Notes: