From 384de9ca52be63a4e40f88e9b7c362a44d0f269c Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Tue, 29 Oct 2019 15:45:48 -0400 Subject: [PATCH] Properly dispose of DescriptorAllocator --- wgpu-native/src/device.rs | 5 +++-- wgpu-native/src/hub.rs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wgpu-native/src/device.rs b/wgpu-native/src/device.rs index cdbe40086..0f0bf913f 100644 --- a/wgpu-native/src/device.rs +++ b/wgpu-native/src/device.rs @@ -775,10 +775,11 @@ impl Device { } } - pub(crate) fn destroy_self(self) { + pub(crate) fn dispose(self) { self.com_allocator.destroy(&self.raw); + let desc_alloc = self.desc_allocator.into_inner(); unsafe { - self.desc_allocator.lock().cleanup(&self.raw); + desc_alloc.dispose(&self.raw); } } } diff --git a/wgpu-native/src/hub.rs b/wgpu-native/src/hub.rs index 0e21b512d..f22a682a6 100644 --- a/wgpu-native/src/hub.rs +++ b/wgpu-native/src/hub.rs @@ -445,7 +445,7 @@ impl Drop for Hub { // self.adapters for (_, (device, _)) in devices.map.drain() { - device.destroy_self(); + device.dispose(); } } }