From 0fce4f95b94328c0ca56c9b7a17d033c2c7a3ee2 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Fri, 9 Feb 2018 15:20:03 +0100 Subject: [PATCH] Properly clean up on exit The SDL clean up does not crash anymore on exit, probably since the memory corruption caused by calling SDLNet_TCP_Close() too early has been resolved. --- app/src/screen.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/app/src/screen.c b/app/src/screen.c index 613bdabe..b9caa9b7 100644 --- a/app/src/screen.c +++ b/app/src/screen.c @@ -15,9 +15,7 @@ SDL_bool sdl_init_and_configure(void) { return SDL_FALSE; } - // FIXME it may crash in SDL_Quit in i965_dri.so - // As a workaround, do not call SDL_Quit() (we are exiting anyway). - // atexit(SDL_Quit); + atexit(SDL_Quit); // Bilinear resizing if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1")) { @@ -187,15 +185,10 @@ void screen_destroy(struct screen *screen) { SDL_DestroyTexture(screen->texture); } if (screen->renderer) { - // FIXME it may crash at exit if we destroy the renderer or the window, - // with the exact same stack trace as . - // As a workaround, leak the renderer and the window (we are exiting anyway). - //SDL_DestroyRenderer(screen->renderer); + SDL_DestroyRenderer(screen->renderer); } if (screen->window) { - //SDL_DestroyWindow(screen->window); - // at least we hide it - SDL_HideWindow(screen->window); + SDL_DestroyWindow(screen->window); } }