aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzakk <zakk@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-09-01 00:24:56 +0000
committerzakk <zakk@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-09-01 00:24:56 +0000
commit6adc12545cd9883e9403b87afdb87a267043db5d (patch)
tree14280187d1589c4a3da2189f876f301adbd6b053
parent08979d84b5368afc912c406e9d1bbc65c6c695c1 (diff)
downloadioquake3-aero-6adc12545cd9883e9403b87afdb87a267043db5d.tar.gz
ioquake3-aero-6adc12545cd9883e9403b87afdb87a267043db5d.zip
From Cameron Eure:
Fixes a problem in code/unix/linux_glimp_sdl.c where attributes are called before there's a working visual, resulting in a crash. git-svn-id: svn://svn.icculus.org/quake3/trunk@55 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--code/unix/linux_glimp_sdl.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/code/unix/linux_glimp_sdl.c b/code/unix/linux_glimp_sdl.c
index 4026e0b..5c1c9a3 100644
--- a/code/unix/linux_glimp_sdl.c
+++ b/code/unix/linux_glimp_sdl.c
@@ -638,18 +638,22 @@ static int GLW_SetMode( const char *drivername, int mode, qboolean fullscreen )
if (tcolorbits == 24)
sdlcolorbits = 8;
- SDL_GL_SetAttribute( SDL_GL_RED_SIZE, sdlcolorbits );
- SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, sdlcolorbits );
- SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, sdlcolorbits );
- SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, tdepthbits );
- SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, tstencilbits );
- SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
-
- SDL_WM_SetCaption(WINDOW_CLASS_NAME, WINDOW_CLASS_NAME_BRIEF);
- SDL_ShowCursor(0);
- SDL_EnableUNICODE(1);
- SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
- sdlrepeatenabled = qtrue;
+
+ /* Cameron Eure - Please don't set attributes unless we have a working visual. */
+ if (vidscreen != NULL){
+ SDL_GL_SetAttribute( SDL_GL_RED_SIZE, sdlcolorbits );
+ SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, sdlcolorbits );
+ SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, sdlcolorbits );
+ SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, tdepthbits );
+ SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, tstencilbits );
+ SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
+
+ SDL_WM_SetCaption(WINDOW_CLASS_NAME, WINDOW_CLASS_NAME_BRIEF);
+ SDL_ShowCursor(0);
+ SDL_EnableUNICODE(1);
+ SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
+ sdlrepeatenabled = qtrue;
+}
if (!(vidscreen = SDL_SetVideoMode(glConfig.vidWidth, glConfig.vidHeight, colorbits, flags)))
{