From 9a049b470c84912134e5479a4189bf2d00f058bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Fri, 2 Aug 2024 18:16:36 +0200 Subject: [PATCH] D3D12: Avoid crash on shutdown --- drivers/d3d12/rendering_context_driver_d3d12.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/d3d12/rendering_context_driver_d3d12.cpp b/drivers/d3d12/rendering_context_driver_d3d12.cpp index cd44441d0ef1..8fa495f5c4f3 100644 --- a/drivers/d3d12/rendering_context_driver_d3d12.cpp +++ b/drivers/d3d12/rendering_context_driver_d3d12.cpp @@ -85,12 +85,14 @@ const GUID CLSID_D3D12SDKConfigurationGodot = { 0x7cda6aca, 0xa03e, 0x49c8, { 0x RenderingContextDriverD3D12::RenderingContextDriverD3D12() {} RenderingContextDriverD3D12::~RenderingContextDriverD3D12() { + // Let's release manually everything that may still be holding + // onto the DLLs before freeing them. device_factory.Reset(); + dxgi_factory.Reset(); + if (lib_d3d12) { FreeLibrary(lib_d3d12); } - - dxgi_factory.Reset(); if (lib_dxgi) { FreeLibrary(lib_dxgi); }