SDL_Quit problem

When my app closes, SDL will not relinquish the screen (which has been running
in fullscreen mode. Here’s the cleanup code, maybe I’m doing something wrong…

int cleanup_SDL(void){

    printf("quitting\n");
SDL_FreeSurface(screen);
printf("screen freed\n");
curbg = numbgs;
printf("%d %d\n",curbg,numbgs);
while (curbg >= 0){
	printf("%d\n",curbg);
	SDL_FreeSurface(bgs[curbg]);
	curbg--;
}
SDL_Quit(); 
return 0;

}

any ideas?

I assume “screen” is the video surface returned by SDL_SetVideoMode().
As mentioned in the doc wiki for SDL_SetVideoMode, you shouldn’t use
SDL_FreeSurface on this SDL_Surface. The video surface is freed
automagically by SDL when you call SDL_Quit(),
SDL_QutSubSystem(SDL_INIT_VIDEO) or if you call SDL_SetVideoMode more
than once the previous screen will be freed.On 3/21/07, Mark Buster wrote:

When my app closes, SDL will not relinquish the screen (which has been running
in fullscreen mode. Here’s the cleanup code, maybe I’m doing something wrong…

int cleanup_SDL(void){

    printf("quitting\n");
    SDL_FreeSurface(screen);
    printf("screen freed\n");
    curbg = numbgs;
    printf("%d %d\n",curbg,numbgs);
    while (curbg >= 0){
            printf("%d\n",curbg);
            SDL_FreeSurface(bgs[curbg]);
            curbg--;
    }
    SDL_Quit();
    return 0;

}

any ideas?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Mark Buster <mbuster mchsi.com> writes:

When my app closes, SDL will not relinquish the screen (which has been running
in fullscreen mode. Here’s the cleanup code, maybe I’m doing something wrong…

Turns out I had a problem with a dynamically allocated multidimensional array
which was seemingly unrelated to SDL…>