Headless: Correct bad pointer without gfx context.

This commit is contained in:
Unknown W. Brackets 2022-08-12 22:41:30 -07:00
parent 9bda04a0d2
commit dedb63532b

View file

@ -80,8 +80,10 @@ public:
} }
void StopThread() override { void StopThread() override {
renderManager_->WaitUntilQueueIdle(); if (renderManager_) {
renderManager_->StopThread(); renderManager_->WaitUntilQueueIdle();
renderManager_->StopThread();
}
} }
void Shutdown() override {} void Shutdown() override {}
@ -90,7 +92,7 @@ public:
void SwapBuffers() override {} void SwapBuffers() override {}
private: private:
Draw::DrawContext *draw_; Draw::DrawContext *draw_ = nullptr;
GLRenderManager *renderManager_ = nullptr; GLRenderManager *renderManager_ = nullptr;
SDL_Window *screen_; SDL_Window *screen_;
SDL_GLContext glContext_; SDL_GLContext glContext_;
@ -201,7 +203,7 @@ bool SDLHeadlessHost::InitGraphics(std::string *error_message, GraphicsContext *
void SDLHeadlessHost::ShutdownGraphics() { void SDLHeadlessHost::ShutdownGraphics() {
gfx_->StopThread(); gfx_->StopThread();
while (threadState_ != RenderThreadState::STOPPED) while (threadState_ != RenderThreadState::STOPPED && threadState_ != RenderThreadState::START_FAILED)
sleep_ms(1); sleep_ms(1);
gfx_->Shutdown(); gfx_->Shutdown();