@@ -1011,9 +1011,9 @@ int flecs_traverse_add(
10111011 }
10121012
10131013 /* Find existing table */
1014- ecs_table_t * src_table = NULL , * table = NULL ;
1014+ ecs_table_t * src_table = NULL , * table = NULL , * init_table = NULL ;
10151015 ecs_record_t * r = flecs_entities_get (world , result );
1016- table = r -> table ;
1016+ init_table = table = r -> table ;
10171017
10181018 /* Add components from the 'add' array */
10191019 if (desc -> add ) {
@@ -1093,7 +1093,7 @@ int flecs_traverse_add(
10931093 const ecs_type_info_t * ti = cr -> type_info ;
10941094 if (ti -> hooks .on_replace ) {
10951095 flecs_invoke_replace_hook (
1096- world , r -> table , result , v -> type , ptr .ptr , v -> ptr , ti );
1096+ world , r -> table , result , v -> type , ptr .ptr , v -> ptr , ti , init_table );
10971097 }
10981098 flecs_copy_id (world , result , r , v -> type ,
10991099 flecs_itosize (ti -> size ), ptr .ptr , v -> ptr , ti );
@@ -2314,7 +2314,7 @@ void flecs_set_id_move(
23142314
23152315 if (ti -> hooks .on_replace ) {
23162316 flecs_invoke_replace_hook (
2317- world , prev_table , entity , component , dst .ptr , ptr , ti );
2317+ world , prev_table , entity , component , dst .ptr , ptr , ti , prev_table );
23182318 }
23192319
23202320 if (cmd_kind != EcsCmdEmplace ) {
@@ -2389,7 +2389,7 @@ void ecs_set_id(
23892389
23902390 if (dst .ti -> hooks .on_replace ) {
23912391 flecs_invoke_replace_hook (
2392- world , prev_table , entity , component , dst .ptr , ptr , dst .ti );
2392+ world , prev_table , entity , component , dst .ptr , ptr , dst .ti , prev_table );
23932393 }
23942394
23952395 flecs_copy_id (world , entity , r , component , size , dst .ptr , ptr , dst .ti );
0 commit comments