Skip to content

Commit efbeacf

Browse files
james7132cart
authored andcommitted
Fix panicking on another scope (#6524)
# Objective Fix #6453. ## Solution Use the solution mentioned in the issue by catching the unwind and dropping the error. Wrap the `executor.try_tick` calls with `std::catch::unwind`. Ideally this would be moved outside of the hot loop, but the mut ref to the `spawned` future is not `UnwindSafe`. This PR only addresses the bug, we can address the perf issues (should there be any) later.
1 parent a2c0f65 commit efbeacf

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

crates/bevy_tasks/src/task_pool.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,11 @@ impl TaskPool {
299299
break result;
300300
};
301301

302-
self.executor.try_tick();
303-
task_scope_executor.try_tick();
302+
std::panic::catch_unwind(|| {
303+
executor.try_tick();
304+
task_scope_executor.try_tick();
305+
})
306+
.ok();
304307
}
305308
}
306309
}

crates/bevy_transform/src/systems.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,7 @@ mod test {
318318
let mut temp = World::new();
319319
let mut app = App::new();
320320

321-
// FIXME: Parallel executors seem to have some odd interaction with the other
322-
// tests in this crate. Using single_threaded until a root cause can be found.
323-
app.add_stage("single", SystemStage::single_threaded())
324-
.add_system_to_stage("single", transform_propagate_system);
321+
app.add_system(transform_propagate_system);
325322

326323
fn setup_world(world: &mut World) -> (Entity, Entity) {
327324
let mut grandchild = Entity::from_raw(0);

0 commit comments

Comments
 (0)