fix the shutdown segfault, closes #2

This commit is contained in:
2026-04-09 10:42:21 +02:00
parent 3f2546edd1
commit bbdab305aa

View File

@@ -236,12 +236,14 @@ bool Application::init(int argc, char** argv) {
} }
void Application::shutdown() { void Application::shutdown() {
if (!window_) return; // already shut down
audio_.closeAll(); audio_.closeAll();
ImGui_ImplOpenGL3_Shutdown(); ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplSDL2_Shutdown(); ImGui_ImplSDL2_Shutdown();
ImGui::DestroyContext(); ImGui::DestroyContext();
if (glContext_) { SDL_GL_DeleteContext(glContext_); glContext_ = nullptr; } if (glContext_) { SDL_GL_DeleteContext(glContext_); glContext_ = nullptr; }
if (window_) { SDL_DestroyWindow(window_); window_ = nullptr; } SDL_DestroyWindow(window_);
window_ = nullptr;
SDL_Quit(); SDL_Quit();
} }