Fixed crash if the OpenGL library hasn't been loaded yet
authorSam Lantinga <slouken@libsdl.org>
Thu, 01 Jan 1970 04:04:21 +0000
changeset 8780 2d8d64a681ad
parent 8779 d21a3ff2b0d2
child 8781 6a9da341d3e8
Fixed crash if the OpenGL library hasn't been loaded yet
src/video/x11/SDL_x11opengl.c
src/video/x11/SDL_x11window.c
--- a/src/video/x11/SDL_x11opengl.c	Sat May 10 21:48:46 2014 -0300
+++ b/src/video/x11/SDL_x11opengl.c	Thu Jan 01 04:04:21 1970 +0000
@@ -511,17 +511,16 @@
 XVisualInfo *
 X11_GL_GetVisual(_THIS, Display * display, int screen)
 {
-    XVisualInfo *vinfo;
-
     /* 64 seems nice. */
     int attribs[64];
-    X11_GL_GetAttributes(_this,display,screen,attribs,64,SDL_FALSE);
+    XVisualInfo *vinfo;
 
     if (!_this->gl_data) {
         /* The OpenGL library wasn't loaded, SDL_GetError() should have info */
         return NULL;
     }
 
+    X11_GL_GetAttributes(_this, display, screen, attribs, 64, SDL_FALSE);
     vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
     if (!vinfo) {
         SDL_SetError("Couldn't find matching GLX visual");
--- a/src/video/x11/SDL_x11window.c	Sat May 10 21:48:46 2014 -0300
+++ b/src/video/x11/SDL_x11window.c	Thu Jan 01 04:04:21 1970 +0000
@@ -373,7 +373,7 @@
 #if SDL_VIDEO_OPENGL_GLX            
             && ( !_this->gl_data || ! _this->gl_data->HAS_GLX_EXT_create_context_es2_profile )
 #endif
-        ){
+        ) {
             vinfo = X11_GLES_GetVisual(_this, display, screen);
         } else
 #endif