From d5dede5a612d04b2d2ec75a9c862e28beb623685 Mon Sep 17 00:00:00 2001 From: Green Sky Date: Tue, 12 Mar 2024 18:42:41 +0100 Subject: [PATCH] properly cleanup in main --- src/main.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index a3f9c6e9..129a51d9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,7 +10,6 @@ #include "./start_screen.hpp" #include -#include #include #include #include @@ -29,8 +28,6 @@ int main(int argc, char** argv) { std::cerr << "SDL_Init failed (" << SDL_GetError() << ")\n"; return 1; } - // me just messing with RAII cleanup - auto sdl_scope = std::async(std::launch::deferred, &SDL_Quit); // more RAII std::unique_ptr window { @@ -86,9 +83,7 @@ int main(int argc, char** argv) { } ImGui_ImplSDL3_InitForSDLRenderer(window.get(), renderer.get()); - auto imgui_sdl_scope = std::async(std::launch::deferred, &ImGui_ImplSDL3_Shutdown); ImGui_ImplSDLRenderer3_Init(renderer.get()); - auto imgui_sdlrenderer_scope = std::async(std::launch::deferred, &ImGui_ImplSDLRenderer3_Shutdown); std::unique_ptr screen = std::make_unique(renderer.get()); @@ -213,6 +208,12 @@ int main(int argc, char** argv) { #endif } + ImGui_ImplSDLRenderer3_Shutdown(); + ImGui_ImplSDL3_Shutdown(); + ImGui::DestroyContext(); + + SDL_Quit(); + return 0; }