Skip to content

Commit

Permalink
D3D12: Avoid crash on shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomShaper committed Aug 2, 2024
1 parent 9e690fa commit 9a049b4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/d3d12/rendering_context_driver_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 9a049b4

Please sign in to comment.