From 0732aaaf67c602888a3879d57dcf121888366126 Mon Sep 17 00:00:00 2001 From: Okko Hakola Date: Wed, 24 Jan 2024 12:37:03 +0200 Subject: [PATCH 1/3] Fix 4604 --- wgpu-hal/src/dx12/instance.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wgpu-hal/src/dx12/instance.rs b/wgpu-hal/src/dx12/instance.rs index 7bf5f3ef75..6eb3847c0c 100644 --- a/wgpu-hal/src/dx12/instance.rs +++ b/wgpu-hal/src/dx12/instance.rs @@ -3,11 +3,14 @@ use winapi::shared::{dxgi1_5, minwindef}; use super::SurfaceTarget; use crate::auxil::{self, dxgi::result::HResult as _}; +use bitflags::Flags; 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(); + } } } From 9d37c11fc8e4a56e1233fc99e2041bfe3d1f1511 Mon Sep 17 00:00:00 2001 From: Okko Hakola Date: Wed, 24 Jan 2024 12:47:43 +0200 Subject: [PATCH 2/3] Changelog update --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cbdac26b4c..53a43857bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,6 +71,9 @@ Bottom level categories: ### Bug Fixes +#### General +- Fix `panic!` when dropping `Instance` without `InstanceFlags::VALIDATION`. By @hakolao in [#5134](https://github.com/gfx-rs/wgpu/pull/5134) + #### WGL - In Surface::configure and Surface::present, fix the current GL context not being unset when releasing the lock that guards access to making the context current. This was causing other threads to panic when trying to make the context current. By @Imberflur in [#5087](https://github.com/gfx-rs/wgpu/pull/5087). From acb6354f980d5c421e4159932125730acf5e6c19 Mon Sep 17 00:00:00 2001 From: Okko Hakola Date: Wed, 24 Jan 2024 13:20:51 +0200 Subject: [PATCH 3/3] Remove unused import --- wgpu-hal/src/dx12/instance.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/wgpu-hal/src/dx12/instance.rs b/wgpu-hal/src/dx12/instance.rs index 6eb3847c0c..47e4463d2b 100644 --- a/wgpu-hal/src/dx12/instance.rs +++ b/wgpu-hal/src/dx12/instance.rs @@ -3,7 +3,6 @@ use winapi::shared::{dxgi1_5, minwindef}; use super::SurfaceTarget; use crate::auxil::{self, dxgi::result::HResult as _}; -use bitflags::Flags; use std::{mem, sync::Arc}; impl Drop for super::Instance {