diff --git a/Qt/QtMain.cpp b/Qt/QtMain.cpp index c9a9ac53a5..a2596d1368 100644 --- a/Qt/QtMain.cpp +++ b/Qt/QtMain.cpp @@ -208,6 +208,7 @@ void MainUI::EmuThreadFunc() { emuThreadState = (int)EmuThreadState::STOPPED; NativeShutdownGraphics(); + graphicsContext->StopThread(); } void MainUI::EmuThreadStart() { diff --git a/Qt/QtMain.h b/Qt/QtMain.h index 404e50439e..191dd320ec 100644 --- a/Qt/QtMain.h +++ b/Qt/QtMain.h @@ -82,6 +82,11 @@ public: renderManager_->ThreadEnd(); } + void StopThread() override { + renderManager_->WaitUntilQueueIdle(); + renderManager_->StopThread(); + } + private: Draw::DrawContext *draw_ = nullptr; GLRenderManager *renderManager_ = nullptr; diff --git a/SDL/SDLGLGraphicsContext.h b/SDL/SDLGLGraphicsContext.h index 52ea68f018..2695ebf64d 100644 --- a/SDL/SDLGLGraphicsContext.h +++ b/SDL/SDLGLGraphicsContext.h @@ -38,6 +38,11 @@ public: renderManager_->ThreadEnd(); } + void StopThread() override { + renderManager_->WaitUntilQueueIdle(); + renderManager_->StopThread(); + } + private: Draw::DrawContext *draw_ = nullptr; SDL_Window *window_; diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index bbf4b42e2e..bdc6c6d973 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -423,6 +423,7 @@ static void EmuThreadFunc(GraphicsContext *graphicsContext) { emuThreadState = (int)EmuThreadState::STOPPED; NativeShutdownGraphics(); + graphicsContext->StopThread(); } static void EmuThreadStart(GraphicsContext *context) {