Fix crash on command buffer drop (#3726)

This commit is contained in:
Andreas Reich 2023-05-03 11:00:59 +02:00 committed by GitHub
parent 66c029f172
commit 1dd105c3bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -40,6 +40,13 @@ Bottom level categories:
## Unreleased
### Bug Fixes
#### General
- Fix crash on dropping `wgpu::CommandBuffer`. By @wumpf in [#3726](https://github.com/gfx-rs/wgpu/pull/3726).
## v0.16.0 (2023-04-19)
### Major changes

View File

@ -574,8 +574,9 @@ static_assertions::assert_impl_all!(CommandBuffer: Send, Sync);
impl Drop for CommandBuffer {
fn drop(&mut self) {
if !thread::panicking() {
if let Some(ref id) = self.id {
self.context.command_buffer_drop(id, &self.data.take());
if let Some(id) = self.id.take() {
self.context
.command_buffer_drop(&id, self.data.take().unwrap().as_ref());
}
}
}