[Scummvm-cvs-logs] CVS: scummvm sdl_gl.cpp,1.8,1.9

Max Horn fingolfin at users.sourceforge.net
Thu Jul 25 16:31:02 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv6815

Modified Files:
	sdl_gl.cpp 
Log Message:
work around a bug in MacOS X OpenGL (it also uses atexit, causing a segfault when ScummVM exits)

Index: sdl_gl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl_gl.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- sdl_gl.cpp	25 Jul 2002 22:27:25 -0000	1.8
+++ sdl_gl.cpp	25 Jul 2002 23:30:43 -0000	1.9
@@ -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 @@
 	void setup_icon();
 };
 
+bool atexit_proc_instaled = false;
 void atexit_proc() {
 	SDL_ShowCursor(SDL_ENABLE);
 	SDL_Quit();
@@ -224,8 +225,11 @@
 	/* 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 @@
 	  }
 	}
 
+#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 @@
 }
 		
 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);
 }





More information about the Scummvm-git-logs mailing list