Search
lxdream.org :: lxdream :: r606:23029426ab8f
lxdream 0.9.1
released Jun 29
Download Now
changeset606:23029426ab8f
parent605:6ecdb604306b
child607:268c85ddc01f
authornkeynes
dateFri Jan 25 05:52:51 2008 +0000 (12 years ago)
Detect if we failed to obtain a GLX visual and abort rather than crashing
src/drivers/video_glx.c
src/gtkui/main_win.c
1.1 --- a/src/drivers/video_glx.c Fri Jan 25 05:38:26 2008 +0000
1.2 +++ b/src/drivers/video_glx.c Fri Jan 25 05:52:51 2008 +0000
1.3 @@ -32,7 +32,7 @@
1.4 static gboolean glsl_loaded = FALSE;
1.5
1.6 static int glx_version = 100;
1.7 -static XVisualInfo *glx_visual;
1.8 +static XVisualInfo *glx_visual = NULL;
1.9 static GLXFBConfig glx_fbconfig;
1.10 static GLXContext glx_context = NULL;
1.11 static gboolean glx_is_initialized = FALSE;
1.12 @@ -100,7 +100,7 @@
1.13 glx_pbuffer_supported = (glx_version >= 103 ||
1.14 isServerGLXExtensionSupported(display, screen,
1.15 "GLX_SGIX_pbuffer") );
1.16 -
1.17 +
1.18 if( glx_fbconfig_supported ) {
1.19 int nelem;
1.20 int fb_attribs[] = { GLX_DRAWABLE_TYPE,
1.21 @@ -125,6 +125,11 @@
1.22 int attribs[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24, 0 };
1.23 glx_visual = glXChooseVisual( display, screen, attribs );
1.24 }
1.25 +
1.26 + if( glx_visual == NULL ) {
1.27 + return FALSE;
1.28 + }
1.29 +
1.30 glx_is_initialized = TRUE;
1.31 return TRUE;
1.32 }
2.1 --- a/src/gtkui/main_win.c Fri Jan 25 05:38:26 2008 +0000
2.2 +++ b/src/gtkui/main_win.c Fri Jan 25 05:52:51 2008 +0000
2.3 @@ -94,7 +94,10 @@
2.4 Display *display = gdk_x11_display_get_xdisplay( gtk_widget_get_display(win->window));
2.5 Screen *screen = gdk_x11_screen_get_xscreen( gtk_widget_get_screen(win->window));
2.6 int screen_no = XScreenNumberOfScreen(screen);
2.7 - video_glx_init(display, screen_no);
2.8 + if( !video_glx_init(display, screen_no) ) {
2.9 + ERROR( "Unable to initialize GLX, aborting" );
2.10 + exit(3);
2.11 + }
2.12
2.13 XVisualInfo *visual = video_glx_get_visual();
2.14 GdkVisual *gdkvis = gdk_x11_screen_lookup_visual( gtk_widget_get_screen(win->window), visual->visualid );
.