Jump to content
  • Advertisement
Sign in to follow this  
SelethD

question on SDL_FreeSurface

This topic is 4493 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!