Skip to content

Commit 979c80d

Browse files
committed
Fix crash on command buffer drop (gfx-rs#3726)
1 parent 25f96b3 commit 979c80d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ Bottom level categories:
4242

4343
### Bug Fixes
4444

45+
#### General
46+
47+
- Fix crash on dropping `wgpu::CommandBuffer`. By @wumpf in [#3726](https://github.com/gfx-rs/wgpu/pull/3726).
48+
4549
#### WebGPU
4650

4751
* Fix crash when calling `create_surface_from_canvas`. By @grovesNL in [#3718](https://github.com/gfx-rs/wgpu/pull/3718)

wgpu/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,9 @@ static_assertions::assert_impl_all!(CommandBuffer: Send, Sync);
574574
impl Drop for CommandBuffer {
575575
fn drop(&mut self) {
576576
if !thread::panicking() {
577-
if let Some(ref id) = self.id {
578-
self.context.command_buffer_drop(id, &self.data.take());
577+
if let Some(id) = self.id.take() {
578+
self.context
579+
.command_buffer_drop(&id, self.data.take().unwrap().as_ref());
579580
}
580581
}
581582
}

0 commit comments

Comments
 (0)