From 1dd105c3bfbb23b4eb88b153198250bfdfe2c950 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Wed, 3 May 2023 11:00:59 +0200 Subject: [PATCH] Fix crash on command buffer drop (#3726) --- CHANGELOG.md | 7 +++++++ wgpu/src/lib.rs | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) 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()); } } }