Ignore listener registrations for removed views, and prune dead ids before layout broadcasts - #1087
Open
criccomini wants to merge 1 commit into
Open
criccomini wants to merge 1 commit into
criccomini wants to merge 1 commit into
Conversation
…efore layout broadcasts A view can be removed by an earlier message in the same update batch as its RegisterListener message. Registering it anyway leaves a dead ViewId in the window's listener list, and the next commit_box_tree panics in ViewStorage::box_tree with 'all view ids are created with a root'.
Contributor
Author
|
(This was Fable low, but the crash and debugging did happen :) |
This branch has not been deployed
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.
Problem
A view can be removed by an earlier update message in the same batch as its own
RegisterListenermessage. TheEditorViewhits this easily because it callsid.register_listener(LayoutChanged::listener_key())when it is built, and an editor inside nesteddyn_containers can be swapped out before that message is processed.When that happens, the
RegisterListenerhandler still pushes the deadViewIdintowindow_state.listeners, and records the key on the shared staleViewStaterather than the real one.remove_viewhas already run, so nothing ever cleans the id out. On the nextcommit_box_tree,get_layouton the dead id returnsSome(the stale state owns a live taffy node), andget_layout_window_originthen callsViewStorage::box_tree, which panics:Fix
RegisterListenerskips ids whose view no longer exists.commit_box_treeprunes invalid ids out of the listener lists before theLayoutChangedandVisualChangedbroadcasts.🤖 Generated with Claude Code