From 15297c85cdc0d8526f979ef69d1ced1a9d013848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Higor=20Eur=C3=ADpedes?= Date: Fri, 22 Aug 2014 19:11:26 -0300 Subject: [PATCH] (sdl_gl) Fix segfault --- gfx/context/sdl_gl_ctx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gfx/context/sdl_gl_ctx.c b/gfx/context/sdl_gl_ctx.c index 6f5913f55b..f8a80c2b10 100644 --- a/gfx/context/sdl_gl_ctx.c +++ b/gfx/context/sdl_gl_ctx.c @@ -89,10 +89,13 @@ static void sdl_ctx_destroy(void *data) if (g_win) SDL_DestroyWindow(g_win); + + g_ctx = NULL; #else - SDL_FreeSurface(g_win); - g_win = NULL; + if (g_win) + SDL_FreeSurface(g_win); #endif + g_win = NULL; SDL_QuitSubSystem(SDL_INIT_VIDEO); }