Skip to content

Commit 3d1135e

Browse files
committed
Fix crash when minimising Unreal engine games.
1 parent a2c207d commit 3d1135e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/d3d9/d3d9_swapchain.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,18 @@ namespace dxvk {
238238
SWP_NOACTIVATE | SWP_NOZORDER | SWP_ASYNCWINDOWPOS);
239239
}
240240
else {
241-
if (IsWindowVisible(window))
241+
if (IsWindowVisible(window)) {
242242
ShowWindow(window, SW_MINIMIZE);
243+
// Some games (Unreal Engine) can manage to recreate the swapchain during window procs
244+
// Grab the swapchain again to ensure it is still valid
245+
std::lock_guard lock(g_windowProcMapMutex);
246+
247+
auto it = g_windowProcMap.find(window);
248+
if (it != g_windowProcMap.end())
249+
windowData = it->second;
250+
else
251+
return 0;
252+
}
243253
}
244254
}
245255
}

0 commit comments

Comments
 (0)