question on SDL_FreeSurface

Started by
1 comment, last by SelethD 18 years ago
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?
Advertisement
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.
Thanks so much for the info, and the speedy reply :)

This topic is closed to new replies.

Advertisement