showimage.c
changeset 7 e1b6443ffb6b
parent 4 b1bb33e907f8
child 9 b2f0eaf93201
     1.1 --- a/showimage.c	Fri Nov 17 21:42:53 2000 +0000
     1.2 +++ b/showimage.c	Wed Nov 29 11:55:32 2000 +0000
     1.3 @@ -85,12 +85,12 @@
     1.4  		fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
     1.5  		exit(255);
     1.6  	}
     1.7 -	atexit(SDL_Quit);
     1.8  
     1.9  	/* Open the image file */
    1.10  	image = IMG_Load(argv[1]);
    1.11  	if ( image == NULL ) {
    1.12  		fprintf(stderr,"Couldn't load %s: %s\n",argv[1],SDL_GetError());
    1.13 +		SDL_Quit();
    1.14  		exit(2);
    1.15  	}
    1.16  	SDL_WM_SetCaption(argv[1], "showimage");
    1.17 @@ -106,6 +106,7 @@
    1.18  	if ( screen == NULL ) {
    1.19  		fprintf(stderr,"Couldn't set %dx%dx%d video mode: %s\n",
    1.20  				image->w, image->h, depth, SDL_GetError());
    1.21 +		SDL_Quit();
    1.22  		exit(3);
    1.23  	}
    1.24  
    1.25 @@ -141,5 +142,6 @@
    1.26  
    1.27  	/* We're done! */
    1.28  	SDL_FreeSurface(image);
    1.29 +	SDL_Quit();
    1.30  	exit(0);
    1.31  }