From 69d9d9f87a4800ab25d82a54fee88685173b967e Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Sun, 26 May 2019 19:59:29 -0700 Subject: [PATCH] Also free when initialization fails, and move to end --- Source/Core/VideoBackends/D3D/D3DBase.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Core/VideoBackends/D3D/D3DBase.cpp b/Source/Core/VideoBackends/D3D/D3DBase.cpp index 88630b2c4c..e2a00e92fe 100644 --- a/Source/Core/VideoBackends/D3D/D3DBase.cpp +++ b/Source/Core/VideoBackends/D3D/D3DBase.cpp @@ -111,7 +111,9 @@ bool Create(u32 adapter_index, bool enable_debug_layer) { PanicAlertT( "Failed to initialize Direct3D.\nMake sure your video card supports at least D3D 10.0"); + dxgi_factory.Reset(); D3DCommon::UnloadLibraries(); + s_d3d11_library.Close(); return false; } @@ -133,7 +135,6 @@ void Destroy() context->ClearState(); context->Flush(); - dxgi_factory.Reset(); context.Reset(); device1.Reset(); @@ -156,6 +157,7 @@ void Destroy() else NOTICE_LOG(VIDEO, "Successfully released all device references!"); + dxgi_factory.Reset(); D3DCommon::UnloadLibraries(); s_d3d11_library.Close(); }