From 446a3dcdbf7e32fb25716c1770e6d896d17ada4e Mon Sep 17 00:00:00 2001 From: Okko Hakola Date: Wed, 24 Jan 2024 13:49:18 +0200 Subject: [PATCH] [d3d12] Avoid panic on instance drop (#5134) --- CHANGELOG.md | 9 ++++++++- wgpu-hal/src/dx12/instance.rs | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f324f1712..b8d565a55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,11 +61,18 @@ Bottom level categories: - `tan` - `tanh` -## v0.19.1 (2024-01-21) +## v0.19.2 (2024-02-29) ### Bug Fixes #### DX12 +- Fix `panic!` when dropping `Instance` without `InstanceFlags::VALIDATION`. By @hakolao in [#5134](https://github.com/gfx-rs/wgpu/pull/5134) + +## v0.19.1 (2024-01-21) + +### Bug Fixes + +#### WGL - Properly register all swapchain buffers to prevent error on surface present. By @dtzxporter in [#5091](https://github.com/gfx-rs/wgpu/pull/5091) - Check for extra null states when creating resources. By @nical in [#5096](https://github.com/gfx-rs/wgpu/pull/5096) diff --git a/wgpu-hal/src/dx12/instance.rs b/wgpu-hal/src/dx12/instance.rs index 7bf5f3ef7..47e4463d2 100644 --- a/wgpu-hal/src/dx12/instance.rs +++ b/wgpu-hal/src/dx12/instance.rs @@ -7,7 +7,9 @@ use std::{mem, sync::Arc}; impl Drop for super::Instance { fn drop(&mut self) { - crate::auxil::dxgi::exception::unregister_exception_handler(); + if self.flags.contains(wgt::InstanceFlags::VALIDATION) { + crate::auxil::dxgi::exception::unregister_exception_handler(); + } } }