-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Query::get
and Query::get_component
return different references
#6623
Comments
I should add that this bug was introduced with bevy 0.9. I noticed it, because I have a similar system in my game which ran fine on bevy 0.8.1, but broke when I updated to 0.9. |
One more thing, I just saw #6622 about duplicate components, and yes, my code would insert a duplicate component onto the last entity on the second frame. But the code panics before that and it didn't make a difference with or without, so I decided to go with the shorter code snippet and not remove explicitly remove |
bisected to fe7ebd4 |
Was able to reproduce the bug. Made the following changes to the example code: // this is where things go wrong
dbg!(entity, get as *const IndexComponent, get_comp as *const IndexComponent);
dbg!(*frame_counter);
if get != get_comp {
panic!("AAAA");
} ... and got the following output:
The returned pointer from |
# Objective Prevent future unsoundness that was seen in #6623. ## Solution Newtype both indexes in `Archetype` and `Table` as `ArchetypeRow` and `TableRow`. This avoids weird numerical manipulation on the indices, and can be stored and treated opaquely. Also enforces the source and destination of where these indices at a type level. --- ## Changelog Changed: `Archetype` indices and `Table` rows have been newtyped as `ArchetypeRow` and `TableRow`.
# Objective Prevent future unsoundness that was seen in #6623. ## Solution Newtype both indexes in `Archetype` and `Table` as `ArchetypeRow` and `TableRow`. This avoids weird numerical manipulation on the indices, and can be stored and treated opaquely. Also enforces the source and destination of where these indices at a type level. --- ## Changelog Changed: `Archetype` indices and `Table` rows have been newtyped as `ArchetypeRow` and `TableRow`.
# Objective Prevent future unsoundness that was seen in bevyengine#6623. ## Solution Newtype both indexes in `Archetype` and `Table` as `ArchetypeRow` and `TableRow`. This avoids weird numerical manipulation on the indices, and can be stored and treated opaquely. Also enforces the source and destination of where these indices at a type level. --- ## Changelog Changed: `Archetype` indices and `Table` rows have been newtyped as `ArchetypeRow` and `TableRow`.
# Objective Prevent future unsoundness that was seen in bevyengine#6623. ## Solution Newtype both indexes in `Archetype` and `Table` as `ArchetypeRow` and `TableRow`. This avoids weird numerical manipulation on the indices, and can be stored and treated opaquely. Also enforces the source and destination of where these indices at a type level. --- ## Changelog Changed: `Archetype` indices and `Table` rows have been newtyped as `ArchetypeRow` and `TableRow`.
…evyengine#6625) # Objective Fix bevyengine#6623. ## Solution Use the right table row instead of the `EntityLocation` archetype index.
# Objective Prevent future unsoundness that was seen in bevyengine#6623. ## Solution Newtype both indexes in `Archetype` and `Table` as `ArchetypeRow` and `TableRow`. This avoids weird numerical manipulation on the indices, and can be stored and treated opaquely. Also enforces the source and destination of where these indices at a type level. --- ## Changelog Changed: `Archetype` indices and `Table` rows have been newtyped as `ArchetypeRow` and `TableRow`.
Bevy version
0.9
308e092
What you did
I ran the following snippet of code
What went wrong
Here,
get
andget_comp
should have the same value, which they do on the first frame, but not on the second.Additional information
In this example
MyEntities
andIndexcComponent
are just some scaffolding in order to demonstrate the problem. What is important isMySparseComponent
and the fact that it is of storage typeSparseSet
.I made a git repo containing this snippet for convenience.
The text was updated successfully, but these errors were encountered: