test/testdyngl.c
changeset 1151 be9c9c8f6d53
parent 990 8e20c48a9c13
child 1386 2b7e0180a72c
     1.1 --- a/test/testdyngl.c	Wed Sep 28 06:38:22 2005 +0000
     1.2 +++ b/test/testdyngl.c	Wed Sep 28 11:36:20 2005 +0000
     1.3 @@ -23,6 +23,13 @@
     1.4  
     1.5  #include "SDL_opengl.h"
     1.6  
     1.7 +/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
     1.8 +static void quit(int rc)
     1.9 +{
    1.10 +	SDL_Quit();
    1.11 +	exit(rc);
    1.12 +}
    1.13 +
    1.14  void* get_funcaddr(const char* p)
    1.15  {
    1.16  	void* f=SDL_GL_GetProcAddress(p);
    1.17 @@ -33,7 +40,7 @@
    1.18  	else
    1.19  	{
    1.20  		printf("Unable to get function pointer for %s\n",p);
    1.21 -		exit(1);
    1.22 +		quit(1);
    1.23  	}
    1.24  }
    1.25  
    1.26 @@ -104,27 +111,25 @@
    1.27  	if (SDL_Init(SDL_INIT_VIDEO)<0)
    1.28  	{
    1.29  		printf("Unable to init SDL : %s\n",SDL_GetError());
    1.30 -		exit(1);
    1.31 +		return(1);
    1.32  	}
    1.33  
    1.34 -	atexit(SDL_Quit);
    1.35 -	
    1.36  	if (SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1)<0)
    1.37  	{
    1.38  		printf("Unable to set GL attribute : %s\n",SDL_GetError());
    1.39 -		exit(1);
    1.40 +		quit(1);
    1.41  	}
    1.42  	
    1.43  	if (SDL_GL_LoadLibrary(gl_library)<0)
    1.44  	{
    1.45  		printf("Unable to dynamically open GL lib : %s\n",SDL_GetError());
    1.46 -		exit(1);
    1.47 +		quit(1);
    1.48  	}
    1.49  
    1.50  	if (SDL_SetVideoMode(640,480,0,SDL_OPENGL)==NULL)
    1.51  	{
    1.52  		printf("Unable to open video mode : %s\n",SDL_GetError());
    1.53 -		exit(1);
    1.54 +		quit(1);
    1.55  	}
    1.56  
    1.57  	/* Set the window manager title bar */