diff --git a/deno_webgpu/device.rs b/deno_webgpu/device.rs index 78e8f1c2f..ce0d9306e 100644 --- a/deno_webgpu/device.rs +++ b/deno_webgpu/device.rs @@ -148,6 +148,9 @@ impl GPUDevice { #[undefined] fn destroy(&self) { self.wgpu_device.destroy(); + // Poll the device to encourage it to process any pending operations + // and release resources associated with the destroyed device (and thus calling lost closure). + let _ = self.wgpu_device.poll(wgpu_types::PollType::Poll); } #[reentrant]