From 3e09fbb66f3d87fe8eb12cb0c1e97680d0be6718 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sat, 2 Feb 2013 21:29:31 -0500 Subject: [PATCH] calling SDL_Quit() stopped the segfault --- sdl_opengl_bare.d | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sdl_opengl_bare.d b/sdl_opengl_bare.d index cc5ae36..e45554d 100644 --- a/sdl_opengl_bare.d +++ b/sdl_opengl_bare.d @@ -16,13 +16,15 @@ int main(char[][] args) SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - SDL_Surface *screen; - if ((screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32, SDL_OPENGL)) == null) + SDL_Surface *screen = SDL_SetVideoMode(WIDTH, HEIGHT, 32, SDL_OPENGL); + if (screen == null) { printf("Failed to set video mode!\n"); SDL_Quit(); return 2; } + SDL_Quit(); + return 0; }