Jump to content

Addictgamer's official blog

  • entries
    67
  • comments
    193
  • views
    17,058

A Never Do With Sdl.


Addictgamer

784 views

 Share

the_surface = SDL_DisplayFormatAlpha(the_surface);
That will cause memory to be lost. It is unrecoverable - a memleak! Everybody's favorite! So ya, you're going to have to do something like this:

	SDL_Surface *the_surface = null;

	SDL_Surface *temp_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, NPP, 0,0,0,0);

	the_surface = SDL_DisplayFormatAlpha(temp_surface);

	SDL_FreeSurface(temp_surface); //Free this.

Ya, I would have much rather preffered removing the temp_surface from that and having the SDL_CreateRGBSurface apply for the_surface, but it don't work! Like I said at the start of this post,
the_surface = SDL_DisplayFormatAlpha(the_surface);

memory leaks.

 Share

0 Comments


Recommended Comments

There are no comments to display.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.