From 9aaf878908c919b1e885cc8097d412c8fb29fe57 Mon Sep 17 00:00:00 2001 From: Themaister Date: Sun, 27 May 2012 15:04:43 +0200 Subject: [PATCH] Init gl handle early. --- gfx/gl.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/gfx/gl.c b/gfx/gl.c index 16e2f4b86f..fb3708bf75 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -946,9 +946,16 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo gfx_set_dwm(); #endif - if (!gfx_ctx_init()) + gl_t *gl = (gl_t*)calloc(1, sizeof(gl_t)); + if (!gl) return NULL; + if (!gfx_ctx_init()) + { + free(gl); + return NULL; + } + unsigned full_x = 0, full_y = 0; gfx_ctx_get_video_size(&full_x, &full_y); RARCH_LOG("Detecting desktop resolution %ux%u.\n", full_x, full_y); @@ -965,7 +972,10 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo if (!gfx_ctx_set_video_mode(win_width, win_height, g_settings.video.force_16bit ? 15 : 0, video->fullscreen)) + { + free(gl); return NULL; + } gfx_ctx_update_window_title(true); @@ -977,17 +987,11 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo if (!load_gl_proc()) { gfx_ctx_destroy(); + free(gl); return NULL; } #endif - gl_t *gl = (gl_t*)calloc(1, sizeof(gl_t)); - if (!gl) - { - gfx_ctx_destroy(); - return NULL; - } - gl->vsync = video->vsync; gl->fullscreen = video->fullscreen;