Repository navigation
gpui: don't shift a scroll layer's own scene index when its list view is drawn again - #51
Merged
Merged
Conversation
… is drawn again follow_paint shifted the layer's paint ranges, scene index included, and only then put the scene index back. A layer's scene index counts from its own scene, so when the view holding the list was drawn after something of its parent's (a sidebar), it lay before the window's and the subtraction underflowed: gpui_perf's showcase panicked scrolling the list page in a debug build.
trancong12102
pushed a commit
to aislopware/gpui-fast
that referenced
this pull request
Oct 9, 2026
…r its parent's backdrop longbridge#51 (a6dc1cb, a985280) stops `follow_paint` shifting a scroll layer's own scene index, which underflowed when the list's view is drawn after something of its parent's. The fork fixed the same shift in 5b02224 (PaintIndex::shifted_outside_scene, which never touches the scene index), so reuse.rs keeps ours and only the PR's regression test, a_list_view_drawn_again_after_its_parents_backdrop_keeps_its_layer, is taken. Reconcile with upstream's version of the fix when longbridge#51 lands. (cherry picked from commit a6dc1cb, test only) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
In a debug build,
gpui_perf's showcase panicked when the List page's list was scrolled:The call path is
reuse_retained_paint→fast/layers/reuse.rsfollow_paint→ itsshiftclosure, whichLayerRows::follow_paintalso uses. A scroll layer's paint ranges count their scene index from the layer's own scene, not the window's.shiftran the scene index throughPaintIndex::shiftedanyway and put it back afterwards. When the view holding the list is drawn after something of its parent's, such as the showcase's sidebar,from.start.scene_indexis greater than the layer's own index, so the subtraction underflowed. Release builds wrap the value and then overwrite it, so nothing showed there.follow_paintnow shifts by copies offrom.startandtowhose scene index is 0, which leaves the layer's own scene index as it is. Every other index shifts exactly as before. No upstream file changes.The other shift sites (
finish_frame,splice.rs,reuse_retained_prepaint/reuse_retained_paint,follow_prepaint) only shift ranges that count from the window's scene, so they cannot hit this.Correctness
a_list_view_drawn_again_after_its_parents_backdrop_keeps_its_layer: a list view drawn after its parent's backdrop, with the parent notified every few frames while it scrolls. Before the fix it panics at the same line through the same path. After the fix it draws as it does with layers off, and the list stays composited. The existing list tests all use the list's view as the root, wherefrom.start.scene_indexis 0, which is why none of them caught this.cargo test -p gpui --features test-support --lib: 647 passed.gpui_perf --headless --verify(debug): all 55 checks identical.gpui_perf --demo: panicked within 90 s before the fix. After it, it ran 180 s, and 120 s after the simplification, with no panic.script/check-upstream: 0 violations.🤖 Generated with Claude Code