Skip to content

Commit b0ccfbf

Browse files
committed
Fix exit crash on Windows ARM64 with D3D11 (and probably also x64 Windows, but couldn't repro that)
1 parent ea2046f commit b0ccfbf

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Windows/EmuThread.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ void MainThreadFunc() {
335335
g_graphicsContext->Shutdown();
336336

337337
delete g_graphicsContext;
338+
g_graphicsContext = nullptr;
338339

339340
RECT rc;
340341
if (console && GetWindowRect(console, &rc) && !IsIconic(console)) {

Windows/GPU/D3D11Context.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,19 @@ void D3D11Context::Shutdown() {
256256
}
257257
#endif
258258

259+
#ifdef _DEBUG
260+
d3dDebug_ = nullptr;
261+
d3dInfoQueue_ = nullptr;
262+
#endif
263+
264+
// Important that we release before we unload the DLL, otherwise we may crash on shutdown.
265+
bbRenderTargetTex_ = nullptr;
266+
bbRenderTargetView_ = nullptr;
267+
context1_ = nullptr;
268+
context_ = nullptr;
269+
device1_ = nullptr;
270+
device_ = nullptr;
259271
hWnd_ = nullptr;
272+
260273
UnloadD3D11();
261274
}

0 commit comments

Comments
 (0)