From ad40156a3b9d2db856f506a9cd21a909fe96038c Mon Sep 17 00:00:00 2001 From: Jupeyy Date: Sat, 27 May 2023 09:23:59 +0200 Subject: [PATCH] Wait for graphics thread's current execution to end before triggering the assert dialog --- src/engine/client/backend_sdl.cpp | 2 ++ src/engine/client/graphics_threaded.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp index 6b4b7d884..8aeb6a8cf 100644 --- a/src/engine/client/backend_sdl.cpp +++ b/src/engine/client/backend_sdl.cpp @@ -777,7 +777,9 @@ void CGraphicsBackend_SDL_GL::ClampDriverVersion(EBackendType BackendType) bool CGraphicsBackend_SDL_GL::ShowMessageBox(unsigned Type, const char *pTitle, const char *pMsg) { if(m_pProcessor != nullptr) + { m_pProcessor->ErroneousCleanup(); + } // TODO: Remove this workaround when https://github.com/libsdl-org/SDL/issues/3750 is // fixed and pass the window to SDL_ShowSimpleMessageBox to make the popup modal instead // of destroying the window before opening the popup. diff --git a/src/engine/client/graphics_threaded.cpp b/src/engine/client/graphics_threaded.cpp index f1277c52a..f7e0270e8 100644 --- a/src/engine/client/graphics_threaded.cpp +++ b/src/engine/client/graphics_threaded.cpp @@ -3283,6 +3283,7 @@ bool CGraphics_Threaded::ShowMessageBox(unsigned Type, const char *pTitle, const { if(m_pBackend == nullptr) return false; + m_pBackend->WaitForIdle(); return m_pBackend->ShowMessageBox(Type, pTitle, pMsg); }