File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18130,6 +18130,8 @@ void flecs_component_delete_non_fragmenting_childof(
1813018130 ecs_world_t *world,
1813118131 ecs_component_record_t *cr)
1813218132{
18133+ cr->flags |= EcsIdMarkedForDelete;
18134+
1813318135 ecs_pair_record_t *pr = cr->pair;
1813418136 int32_t i, count = ecs_vec_count(&pr->ordered_children);
1813518137 ecs_entity_t *children = ecs_vec_first(&pr->ordered_children);
Original file line number Diff line number Diff line change @@ -204,6 +204,8 @@ void flecs_component_delete_non_fragmenting_childof(
204204 ecs_world_t * world ,
205205 ecs_component_record_t * cr )
206206{
207+ cr -> flags |= EcsIdMarkedForDelete ;
208+
207209 ecs_pair_record_t * pr = cr -> pair ;
208210 int32_t i , count = ecs_vec_count (& pr -> ordered_children );
209211 ecs_entity_t * children = ecs_vec_first (& pr -> ordered_children );
Original file line number Diff line number Diff line change @@ -5772,9 +5772,18 @@ void NonFragmentingChildOf_delete_mixed_tree_2(void) {
57725772}
57735773
57745774void NonFragmentingChildOf_delete_mixed_tree_3 (void ) {
5775- ecs_world_t * world = ecs_init (); // using ecs_init vs. ecs_mini causes a crash
5775+ ecs_world_t * world = ecs_mini ();
5776+
5777+ ECS_TAG (world , Foo );
5778+
5779+ ecs_observer (world , {
5780+ .query .terms = {{ Foo , .src .id = EcsUp }},
5781+ .events = { EcsOnRemove },
5782+ .callback = DummyObserver
5783+ });
57765784
57775785 ecs_entity_t root = ecs_new (world );
5786+ ecs_add (world , root , Foo );
57785787 ecs_entity_t prefab = ecs_new_w_id (world , EcsPrefab );
57795788
57805789 ecs_entity_t parent = ecs_new (world );
@@ -5789,5 +5798,10 @@ void NonFragmentingChildOf_delete_mixed_tree_3(void) {
57895798
57905799 ecs_delete (world , root );
57915800
5801+ test_assert (!ecs_is_alive (world , root ));
5802+ test_assert (!ecs_is_alive (world , parent ));
5803+ test_assert (!ecs_is_alive (world , child_a ));
5804+ test_assert (!ecs_is_alive (world , child_b ));
5805+
57925806 ecs_fini (world );
57935807}
You can’t perform that action at this time.
0 commit comments