Commit 5b2a5e34 authored by Sam Lantinga's avatar Sam Lantinga

Fixed bug 1313 - Segfault on SDL_CreateWindow when gl lib cannot be loaded

Don't crash if the gl_data isn't valid, just return NULL.
parent 1dafe0e9
......@@ -187,8 +187,10 @@ X11_GL_UnloadLibrary(_THIS)
#endif
/* Free OpenGL memory */
if (_this->gl_data) {
SDL_free(_this->gl_data);
_this->gl_data = NULL;
}
}
static SDL_bool
......@@ -396,6 +398,11 @@ X11_GL_GetVisual(_THIS, Display * display, int screen)
const int i = X11_GL_GetAttributes(_this,display,screen,attribs,max_attrs);
SDL_assert(i <= max_attrs);
if (!_this->gl_data) {
/* The OpenGL library wasn't loaded, SDL_GetError() should have info */
return NULL;
}
vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs);
if (!vinfo) {
SDL_SetError("Couldn't find matching GLX visual");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment