fix the shutdown segfault, closes #2
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user