Closed
Description
Bevy version
Master
Operating system & version
Arch Linux
What you did
use bevy::prelude::*;
struct Dropper(i32);
impl Drop for Dropper {
fn drop(&mut self) {
println!("drop {}", self.0);
if self.0 == 0 {
panic!();
}
}
}
fn main() {
App::new()
.add_startup_system(setup.system())
.run();
}
fn setup(mut commands: Commands) {
commands.spawn()
.insert(Dropper(0))
.insert(Dropper(1));
}
What you expected to happen
drop 0
is printed at most once.
What actually happened
drop 0
is printed twice.
Additional information
Several functions in https://github.com/bevyengine/bevy/blob/43d99bb583866c1adb4aa88f19b88637df0a7f33/crates/bevy_ecs/src/storage/blob_vec.rs do not handle self.drop
unwinding (nor require their callers to do so.)