Sign in to follow this  
SelethD

question on SDL_FreeSurface

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this