Sign in to follow this  
bori

SDL_CreateRGBSurface - SIGSEGV [SOLVED]

Recommended Posts

Hi all. My app just started SIGSEGVing (trying to access denied memory). I debugged it a bit and found the place of crash.

GLuint AcImageLoader::CreateTexture(SDL_Surface *surface) {
    
   GLuint texture = 0;
   Uint32 saved_flags;
   Uint8  saved_alpha;
   
   
   SDL_Surface *tmp_img;
   
   tmp_img = SDL_CreateRGBSurface(SDL_SWSURFACE, surface->w, surface->h, 32,
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
   0x000000FF,
   0x0000FF00,
   0x00FF0000,
   0xFF000000
#else
   0xFF000000,
   0x00FF0000,
   0x0000FF00,
   0x000000FF
#endif
   );

...

This function is given a surface with pixmap (got from SDL IMG_Load()) and it should convert it to RGBA and swap its rows (further in code, I didn't posted it). However calling SDL_CreateRGBSurface(...) invokes SIGSEGV. Weird thing is that it worked fine and I haven't changed anything in this function. I haven't a clue. Can you help me? Thanks in advance, bori [Edited by - bori on January 27, 2008 4:13:28 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by rip-off
Is "surface" a valid pointer?


Well, that's the problem. I went a bit further in debugging and found out that my version of SDL_image can't handle with JPEG.

Thank you!

Share this post


Link to post
Share on other sites
Quote:
Original post by bori
Quote:
Original post by rip-off
Is "surface" a valid pointer?


Well, that's the problem. I went a bit further in debugging and found out that my version of SDL_image can't handle with JPEG.

Thank you!


If you download the SDL_Image DLL, you can copy all the other DLLs in the folder too, to support them. Have you jpeg.dll in the same folder as SDL_Image.dll?

Share this post


Link to post
Share on other sites
Quote:
Original post by rip-off
If you download the SDL_Image DLL, you can copy all the other DLLs in the folder too, to support them. Have you jpeg.dll in the same folder as SDL_Image.dll?


Well, I'm compiling SDL from source, because I'm not using Windows, but thanks for reply. ;)

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