bevy/crates/bevy_ecs/src
Giacomo Stevanato 106db47f69
Fix subtle/weird UB in the multi threaded executor (#15309)
# Objective

- The multithreaded executor has some weird UB related to stacked
borrows and async blocks
- See my explanation on discord
https://discord.com/channels/691052431525675048/749335865876021248/1286359267921887232
- Closes #15296 (can this be used to close PRs?)

## Solution

- Don't create a `&mut World` reference outside `async` blocks and then
capture it, but instead directly create it inside the `async` blocks.
This avoids it being captured, which has some weird requirement on its
validity.

## Testing

- Added a regression test
2024-09-19 18:15:58 +00:00
..
entity Substitute trivial fallible conversions with infallible function calls (#10846) 2024-09-16 22:46:54 +00:00
event Rename Add to Queue for methods with deferred semantics (#15234) 2024-09-17 00:17:49 +00:00
identifier Migrated NonZero* to NonZero<*> (#14978) 2024-08-30 02:37:47 +00:00
observer Rename Add to Queue for methods with deferred semantics (#15234) 2024-09-17 00:17:49 +00:00
query Enable clippy::check-private-items so that missing_safety_doc will apply to private functions as well (#15161) 2024-09-18 15:28:41 +00:00
reflect Rename Add to Queue for methods with deferred semantics (#15234) 2024-09-17 00:17:49 +00:00
schedule Fix subtle/weird UB in the multi threaded executor (#15309) 2024-09-19 18:15:58 +00:00
storage Enable clippy::check-private-items so that missing_safety_doc will apply to private functions as well (#15161) 2024-09-18 15:28:41 +00:00
system command based entry api with EntityCommands::entry (#15274) 2024-09-19 15:20:13 +00:00
world Fix memory leak in world's command queue (#15295) 2024-09-19 16:44:15 +00:00
archetype.rs Add EntityRefExcept and EntityMutExcept world queries, in preparation for generalized animation. (#15207) 2024-09-17 14:53:39 +00:00
batching.rs Parallel event reader (#12554) 2024-04-22 16:37:42 +00:00
bundle.rs Enable clippy::check-private-items so that missing_safety_doc will apply to private functions as well (#15161) 2024-09-18 15:28:41 +00:00
change_detection.rs Add filter_map_unchanged to Mut<T> (#14837) 2024-08-22 17:51:21 +00:00
component.rs Enable clippy::check-private-items so that missing_safety_doc will apply to private functions as well (#15161) 2024-09-18 15:28:41 +00:00
intern.rs Moves intern and label modules into bevy_ecs (#12772) 2024-04-08 15:34:11 +00:00
label.rs Add mappings to EntityMapper (#13727) 2024-06-08 12:52:23 +00:00
lib.rs Remove redundent information and optimize dynamic allocations in Table (#12929) 2024-09-16 22:52:05 +00:00
removal_detection.rs Created an EventMutator for when you want to mutate an event before reading (#13818) 2024-07-08 14:53:06 +00:00
traversal.rs Minimal Bubbling Observers (#13991) 2024-07-15 13:39:41 +00:00