Skip to content

Commit 906b406

Browse files
authored
Prevent double panic in the Drop of TaksPoolInner (#1064)
1 parent 814c413 commit 906b406

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

crates/bevy_tasks/src/task_pool.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,12 @@ impl Drop for TaskPoolInner {
6969
fn drop(&mut self) {
7070
self.shutdown_tx.close();
7171

72+
let panicking = thread::panicking();
7273
for join_handle in self.threads.drain(..) {
73-
join_handle
74-
.join()
75-
.expect("Task thread panicked while executing.");
74+
let res = join_handle.join();
75+
if !panicking {
76+
res.expect("Task thread panicked while executing.");
77+
}
7678
}
7779
}
7880
}

0 commit comments

Comments
 (0)