seat: fix NULL deref in handle_seat_node_destroy - #9246
Open
matheusc457 wants to merge 2 commits into
Open
Conversation
seat_get_focus_inactive(seat, &root->node) can return NULL when the seat's focus_stack is empty (e.g. a secondary seat that never received real focus, in a multi-seat setup, once the last tracked container/workspace in its focus_stack is destroyed). The focus_inactive branch of handle_seat_node_destroy dereferenced that return value unconditionally (focus->type), causing an immediate crash of the whole compositor in that state. This guards the dereference with a NULL check, matching the safe usage pattern already used elsewhere in the codebase (workspace_consider_destroy compares the return value with == instead of dereferencing it directly).
WhyNotHugo
approved these changes
Aug 4, 2026
WhyNotHugo
left a comment
Contributor
There was a problem hiding this comment.
LGTM, description and implementation are both sound.
Avoids the extra indentation level, as suggested by WhyNotHugo in review.
WhyNotHugo
approved these changes
Aug 5, 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.
seat_get_focus_inactive(seat, &root->node) can return NULL when the seat's focus_stack is empty (e.g. a secondary seat that never received real focus, in a multi-seat setup, once the last tracked container/workspace in its focus_stack is destroyed).
The focus_inactive branch of handle_seat_node_destroy dereferenced that return value unconditionally
(focus->type), causing an immediate crash of the whole compositor in that state.
This guards the dereference with a NULL check, matching the safe usage pattern already used elsewhere in the codebase (workspace_consider_destroy compares the return value with == instead of dereferencing it directly).