From 52e03c765d9cc1eb0dbeb7da60c57b1c58c65652 Mon Sep 17 00:00:00 2001 From: Dennis Felsing Date: Thu, 13 Jan 2022 14:22:10 +0100 Subject: [PATCH] Fix crash in macOS when moving screen (fixes #4435) Thanks to Jupeyy for the suggestion --- src/engine/client/graphics_threaded.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp index 3b00f7d12..1d0972f44 100644 --- a/src/engine/client/graphics_threaded.cpp +++ b/src/engine/client/graphics_threaded.cpp @@ -2387,7 +2387,7 @@ void CGraphics_Threaded::Resize(int w, int h, int RefreshRate, bool SetWindowSiz return; } - // kick the command buffer + // kick the command buffer and wait KickCommandBuffer(); WaitForIdle(); @@ -2506,6 +2506,11 @@ void CGraphics_Threaded::Swap() // kick the command buffer KickCommandBuffer(); + // TODO: Remove when https://github.com/libsdl-org/SDL/issues/5203 is fixed +#ifdef CONF_PLATFORM_MACOS + if(str_find(GetVersionString(), "Metal")) + WaitForIdle(); +#endif } bool CGraphics_Threaded::SetVSync(bool State)