question on SDL_FreeSurface
I have noticed in a sample program, that there are two surfaces created
SDL_Surface *image = NULL;
SDL_Surface *screen = NULL;
screen = SDL_SetVideoMode(WIDTH,HEIGHT,BPP,SDL_SWSURFACE);
image = SDL_LoadBMP(filename);
then on exit, I see this...
SDL_FreeSurface(image);
SDL_Quit();
So where is the Free Surface for the 'screen' surface? Is it a bug in this example, or is it not needed since 'screen' is set up using SetVideoMode?
Quote:Original post by SelethD
So where is the Free Surface for the 'screen' surface? Is it a bug in this example, or is it not needed since 'screen' is set up using SetVideoMode?
It is not needed since screen was setup with SetVideoMode. SDL will take care of that for you [wink] Any surface allocated by the SetVideoMode should never be freed in your program. It might not do anything on your computer, but on other computers or platforms, it might have disastrous results.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement