[SDL] Segmentation fault in SDL_DisplayFormat{,Alpha}

James Barrett xucaen at gmail.com
Sat Sep 15 16:47:41 PDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

charly wrote:
> And here's my load_image function:
>
>     if( loadedImage != NULL )
>     {
>         std::cout << "Image loaded!\n";
>         Uint32 colorkey = SDL_MapRGB( loadedImage->format, 0xFF, 0, 0xFF );
>         optimizedImage = SDL_DisplayFormatAlpha( loadedImage );
>         SDL_FreeSurface( loadedImage );
>     }
>     return optimizedImage;
> }

Hi, I think you want to say
if( loadedImage == null)
{
    error
}

So, the way you have it, every time it loads an image, it will return
an error.

Jim


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFG7G8dQuDJiZ/QrH0RAjBMAKDBb5gGRYZHHq7LRrCJQfjgQ/Ky8gCgxpxE
Hny/lND8/mE0tVmwiEVBHts=
=NXF9
-----END PGP SIGNATURE-----



More information about the SDL mailing list