bevy/crates/bevy_ecs/src/system
Gabriel Bourgeois 092bb71bcf Clean up taffy nodes when UI node entities are removed (#5886)
# Objective

Clean up taffy nodes when the associated UI node gets removed. The current UI code will keep the taffy nodes around forever.

## Solution

Use `RemovedComponents<Node>` to iterate over nodes that are no longer valid UI nodes or that have been despawned, and remove them from taffy and the internal hash map.

## Implementation Notes

Do note that using `despawn()` instead of `despawn_recursive()` on a UI node that has children will result in a [warnings spam](https://github.com/bevyengine/bevy/blob/main/crates/bevy_ui/src/flex/mod.rs#L120) since the children will not be part of a proper UI hierarchy anymore.

---

## Changelog

- Fixed memory leak when nodes are removed in bevy_ui
2022-09-05 21:50:31 +00:00
..
commands Add get_entity to Commands (#5854) 2022-09-01 22:06:46 +00:00
exclusive_system.rs Make Resource trait opt-in, requiring #[derive(Resource)] V2 (#5577) 2022-08-08 21:36:35 +00:00
function_system.rs Added the ability to get or set the last change tick of a system. (#5838) 2022-08-31 01:53:15 +00:00
mod.rs Remove last uses of string-labels (#5420) 2022-09-03 18:06:41 +00:00
query.rs Update Query methods documentation (#5742) 2022-09-02 16:33:19 +00:00
system_chaining.rs Added the ability to get or set the last change tick of a system. (#5838) 2022-08-31 01:53:15 +00:00
system_param.rs Clean up taffy nodes when UI node entities are removed (#5886) 2022-09-05 21:50:31 +00:00
system.rs Added the ability to get or set the last change tick of a system. (#5838) 2022-08-31 01:53:15 +00:00