Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid unconditionally unwrapping the Result - UI Stack System #11575

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

garychia
Copy link
Contributor

Objective

Solution

  • Avoid unconditionally unwrapping the Result in the ui_stack_system function.

@JMS55 JMS55 added C-Bug An unexpected or incorrect behavior A-UI Graphical user interfaces, styles, layouts, and widgets labels Jan 28, 2024
@Hexorg
Copy link
Contributor

Hexorg commented Jan 28, 2024

Ah thank you for fixing this. So On deeper digging I found that this error is caused because despawning a child does not automatically remove the child from its Parent, and so UI stack gets re-populated with removed entity because parent still thinks they have a child. I think I better fix would be to remove children from parents on despawn.

@alice-i-cecile
Copy link
Member

I think I better fix would be to remove children from parents on despawn.

IMO we should do both. I'm happy with this PR as a first step, and then that as a more complex and controversial follow-up fix.

Copy link
Member

@james7132 james7132 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in agreement that we should have despawn remove the references in relations, but that might be more involved than what is reasonable for this PR.

Also generally avoiding panics is good for performance too: less codegen.

@alice-i-cecile alice-i-cecile added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Jan 29, 2024
@james7132 james7132 added this pull request to the merge queue Jan 29, 2024
Merged via the queue into bevyengine:main with commit fb124c3 Jan 29, 2024
26 checks passed
@garychia garychia deleted the ui_node_unwrap branch January 29, 2024 06:22
tjamaan pushed a commit to tjamaan/bevy that referenced this pull request Feb 6, 2024
…gine#11575)

# Objective

- Fixes bevyengine#11572

## Solution

- Avoid unconditionally unwrapping the `Result` in the `ui_stack_system`
function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ui_focus_system crashes if UI Node is removed by clicking on it.
5 participants