diff options
author | Max Horn | 2002-07-25 23:30:43 +0000 |
---|---|---|
committer | Max Horn | 2002-07-25 23:30:43 +0000 |
commit | 4211eb8437e5708d9644ded1dd89c9cf526fbf92 (patch) | |
tree | 9ec75f588bbf9cc2f37623fbd15d911822939db5 | |
parent | 028d2e26048c7b3266f4f933545dbe165e34e58b (diff) | |
download | scummvm-rg350-4211eb8437e5708d9644ded1dd89c9cf526fbf92.tar.gz scummvm-rg350-4211eb8437e5708d9644ded1dd89c9cf526fbf92.tar.bz2 scummvm-rg350-4211eb8437e5708d9644ded1dd89c9cf526fbf92.zip |
work around a bug in MacOS X OpenGL (it also uses atexit, causing a segfault when ScummVM exits)
svn-id: r4634
-rw-r--r-- | sdl_gl.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/sdl_gl.cpp b/sdl_gl.cpp index ec10400373..961886c98d 100644 --- a/sdl_gl.cpp +++ b/sdl_gl.cpp @@ -34,12 +34,12 @@ #include <SDL_thread.h> #ifdef WIN32 -int glColorTable(int, int, int, int, int, void *){ return 0; } -int glGetColorTable(int, int, int, void *){ return 0; } +int glColorTable(int, int, int, int, int, void *) { return 0; } +int glGetColorTable(int, int, int, void *) { return 0; } /* Use OpenGL 1.1 */ -bool OGL_1_1=true; +bool OGL_1_1 = true; #else -bool OGL_1_1=false; +bool OGL_1_1 = false; #endif #include "fb2opengl.h" @@ -201,6 +201,7 @@ private: void setup_icon(); }; +bool atexit_proc_instaled = false; void atexit_proc() { SDL_ShowCursor(SDL_ENABLE); SDL_Quit(); @@ -224,8 +225,11 @@ OSystem *OSystem_SDL::create(int gfx_mode, bool full_screen) { /* Setup the icon */ syst->setup_icon(); +#ifndef MACOSX // Work around a bug in OS X /* Clean up on exit */ + atexit_proc_instaled = true; atexit(atexit_proc); +#endif return syst; } @@ -286,6 +290,13 @@ void OSystem_SDL::load_gfx_mode() { } } +#ifdef MACOSX // Work around a bug in OS X + if (!atexit_proc_instaled) { + atexit_proc_instaled = true; + atexit(atexit_proc); + } +#endif + SDL_SetGamma(1.25,1.25,1.25); sdl_tmpscreen = sdl_screen; @@ -755,10 +766,10 @@ uint32 OSystem_SDL::property(int param, Property *value) { } void OSystem_SDL::quit() { - if(cdrom) { - SDL_CDStop(cdrom); - SDL_CDClose(cdrom); - } + if(cdrom) { + SDL_CDStop(cdrom); + SDL_CDClose(cdrom); + } unload_gfx_mode(); exit(1); } |