diff --git a/CHANGELOG.md b/CHANGELOG.md index 49048f2f4c..9c77604fe3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index 3b98e1e1a6..ea26098916 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -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()); } } }