bevy/crates/bevy_ecs/src/system
Carter Anderson dfb80ee74f Fix query.to_readonly().get_component_mut() soundness bug (#6401)
# Objective

Fix the soundness issue outlined in #5866. In short the problem is that `query.to_readonly().get_component_mut::<T>()` can provide unsound mutable access to the component. This PR is an alternative to just removing the offending api. Given that `to_readonly` is a useful tool, I think this approach is a preferable short term solution. Long term I think theres a better solution out there, but we can find that on its own time.

## Solution

Add what amounts to a "dirty flag" that marks Queries that have been converted to their read-only variant via `to_readonly` as dirty. When this flag is set to true, `get_component_mut` will fail with an error, preventing the unsound access.
2022-10-29 04:13:54 +00:00
..
commands Document EntityCommands/EntityMut insert() (#6270) 2022-10-17 14:38:58 +00:00
exclusive_function_system.rs Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
exclusive_system_param.rs Exclusive Systems Now Implement System. Flexible Exclusive System Params (#6083) 2022-09-26 23:57:07 +00:00
function_system.rs Rename system chaining to system piping (#6230) 2022-10-11 15:21:12 +00:00
mod.rs Fix query.to_readonly().get_component_mut() soundness bug (#6401) 2022-10-29 04:13:54 +00:00
query.rs Fix query.to_readonly().get_component_mut() soundness bug (#6401) 2022-10-29 04:13:54 +00:00
system_param.rs Implement IntoIterator for ECS wrapper types. (#5096) 2022-10-24 21:01:08 +00:00
system_piping.rs Rename system chaining to system piping (#6230) 2022-10-11 15:21:12 +00:00
system.rs Adding Debug implementations for App, Stage, Schedule, Query, QueryState, etc. (#6214) 2022-10-10 20:59:38 +00:00