SDL w/ GL crashes X windows (linux) at exit

I’ve done some 3D openGL stuff with glut and decided to switch to SDL for the sound, etc.

Unfortunately, any SDL program with openGL in it seems to have a chance of causing a segfault in* after it exits, which causes X windows to crash. Having to restart X with any frequency is not a very ideal way to work.

This includes “example 2.8” from the SDL Guide section on using GL, which was what I based my own code on. The crash seems to be far more likely if I set the video mode to anything other than 640x480, and also if I do not run FULLSCREEN. Fullscreen 640x480 looks like crap, of course.

I have searched the SDL Guide and done some googling, but I can find no meaningful information at all about the significance of the resolution used in SetVideoMode, or regarding the SDL_GL_Attributes, beyond a statement that you want SDL_GL_RED/BLUE/GREEN to be “at least 5”. How do these numbers relate to the bpp/depth set with SetVideoMode? Since the resolution seems to affect the frequency of the problem, my last hope here is that I can get some help with determining the “ideal” values (unless that means being stuck with 640x480, which is just not worthwhile).

I never had any problem with GL under glut, which does not involve this setting of video modes – you just pick a window size, and the “resolution” will match. All the relevant libraries are distro binaries, fedora core 10-64.

*ie, the backtrace begins and ends there

What graphics-card do you have? I have Ubuntu 8.10 with ATI Radeon 3200 onboard
graphics and SDL with OpenGL runs fine - except fullscreen mode.