bevy/crates
Chris Juchem 65dbfe249b
Remove extra call to clear_trackers (#13762)
Fixes #13758.

# Objective

Calling `update` on the main app already calls `clear_trackers`. Calling
it again in `SubApps::update` caused RemovedCompenet Events to be
cleared earlier than they should be.

## Solution

- Don't call clear_trackers an extra time.

## Testing

I manually tested the fix with this unit test: 
```
#[cfg(test)]
mod test {
    use crate::core::{FrameCount, FrameCountPlugin};
    use crate::prelude::*;

    #[test]
    fn test_next_frame_removal() {
        #[derive(Component)]
        struct Foo;

        #[derive(Resource)]
        struct RemovedCount(usize);

        let mut app = App::new();
        app.add_plugins(FrameCountPlugin);
        app.add_systems(Startup, |mut commands: Commands| {
            for _ in 0..100 {
                commands.spawn(Foo);
            }
            commands.insert_resource(RemovedCount(0));
        });

        app.add_systems(First, |counter: Res<FrameCount>| {
            println!("Frame {}:", counter.0)
        });

        fn detector_system(
            mut removals: RemovedComponents<Foo>,
            foos: Query<Entity, With<Foo>>,
            mut removed_c: ResMut<RemovedCount>,
        ) {
            for e in removals.read() {
                println!("  Detected removed Foo component for {e:?}");
                removed_c.0 += 1;
            }
            let c = foos.iter().count();
            println!("  Total Foos: {}", c);
            assert_eq!(c + removed_c.0, 100);
        }
        fn deleter_system(foos: Query<Entity, With<Foo>>, mut commands: Commands) {
            foos.iter().next().map(|e| {
                commands.entity(e).remove::<Foo>();
            });
        }
        app.add_systems(Update, (detector_system, deleter_system).chain());

        app.update();
        app.update();
        app.update();
        app.update();
    }
}
```
2024-06-10 20:23:06 +02:00
..
bevy_a11y Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_animation Make the component types of the new animation players clonable. (#13736) 2024-06-09 01:18:07 +02:00
bevy_app Remove extra call to clear_trackers (#13762) 2024-06-10 20:23:06 +02:00
bevy_asset Improve error handling for AssetServer::add_async (#13745) 2024-06-10 19:31:41 +02:00
bevy_audio Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_color Adds back in way to convert color to u8 array, implemented for the two RGB color types, also renames Color::linear to Color::to_linear. (#13759) 2024-06-10 19:31:41 +02:00
bevy_core Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_core_pipeline Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_derive Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_dev_tools Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_diagnostic Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_dylib Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_dynamic_plugin Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_ecs Remove extra call to clear_trackers (#13762) 2024-06-10 20:23:06 +02:00
bevy_encase_derive Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_gilrs Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_gizmos view.inverse_clip_from_world should be world_from_clip (#13756) 2024-06-09 16:55:22 +02:00
bevy_gltf Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_hierarchy Fix EntityCommands::despawn docs (#13774) 2024-06-09 20:52:52 +02:00
bevy_input Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_internal Update serialize flag for bevy_ecs (#13740) 2024-06-10 19:31:41 +02:00
bevy_log Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_macro_utils Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_math Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_mikktspace Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_pbr Make FOG_ENABLED a shader_def instead of material flag (#13783) 2024-06-10 19:31:41 +02:00
bevy_ptr Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_reflect Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_render Clarify error message due to missing shader file (#13766) 2024-06-10 19:31:41 +02:00
bevy_scene Update serialize flag for bevy_ecs (#13740) 2024-06-10 19:31:41 +02:00
bevy_sprite Adds back in way to convert color to u8 array, implemented for the two RGB color types, also renames Color::linear to Color::to_linear. (#13759) 2024-06-10 19:31:41 +02:00
bevy_state fix docs around StateTransition and remove references to `apply_sta… (#13772) 2024-06-10 19:31:41 +02:00
bevy_tasks Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_text Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_time Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_transform Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_ui Adds back in way to convert color to u8 array, implemented for the two RGB color types, also renames Color::linear to Color::to_linear. (#13759) 2024-06-10 19:31:41 +02:00
bevy_utils Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_window Release Candidate 0.14.0-rc.2 2024-06-06 23:56:56 +02:00
bevy_winit 13743 app exit hang (#13744) 2024-06-09 01:18:07 +02:00