-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
ecsRelating to the entity component system framework.Relating to the entity component system framework.
Description
Returning references to components is bad, since we can run into reference invalidation. This is when the vector reallocates its memory in order to grow, meaning all the components are reallocated, causing the references to be invalid. The following test:
gives this output:
most likely as a result of the original reference pointing to an invalid block of memory. Obviously an easy solution is to just not do something like this in your code, i.e. do not use a component retrieved from the list before you add a new component. However I'd also like to look at some alternatives.
Note: this issue was originally opened on the ape2d-ecs repository.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ecsRelating to the entity component system framework.Relating to the entity component system framework.

