ecs: ECS fixes #334

Merged
dweiller merged 2 commits from main into main 2022-06-08 02:26:41 +00:00
dweiller commented 2022-06-07 11:31:16 +00:00 (Migrated from github.com)

Two small fixes for the ECS

  • Fix the usage of copy(), which had the src_row and dst_row arguments supplied in the wrong order
  • Fix a bug cause by pointer invalidation in the setComponent() and removeComponent() functions, caused by getOrPut() on the hash map sometimes invalidating the archetype retrieved by archetypeByID().

I haven't made a minimal reproducible example for the second bug, it doesn't show up under all circumstances, in my use it showed up when 'enough' stuff was added to the ECS, which must have made getOrPutContext() more likely to invalidate the pointer.

Perhaps there is a better way to rewrite the usage of archetype in the functions, this is just the minimal change that stops things crashing.

  • By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.
Two small fixes for the ECS - Fix the usage of `copy()`, which had the `src_row` and `dst_row` arguments supplied in the wrong order - Fix a bug cause by pointer invalidation in the `setComponent()` and `removeComponent()` functions, caused by `getOrPut()` on the hash map sometimes invalidating the archetype retrieved by `archetypeByID()`. I haven't made a minimal reproducible example for the second bug, it doesn't show up under all circumstances, in my use it showed up when 'enough' stuff was added to the ECS, which must have made `getOrPutContext()` more likely to invalidate the pointer. Perhaps there is a better way to rewrite the usage of `archetype` in the functions, this is just the minimal change that stops things crashing. - [x] By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.
emidoots (Migrated from github.com) approved these changes 2022-06-08 02:26:30 +00:00
emidoots (Migrated from github.com) left a comment

Thanks! I have more major changes to this ECS library coming soon. Interesting to hear you are using it for something! In general (and as you have found) I would say it's not ready for that yet :)

Thanks! I have more major changes to this ECS library coming soon. Interesting to hear you are using it for something! In general (and as you have found) I would say it's not ready for that yet :)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach!334
No description provided.