[SDL] EXC_BAD_ACCESS on SDL_ConvertSurface Mac OS X
Alvin
alvinbeach at gmail.com
Sat Mar 8 15:32:19 PST 2008
On Saturday 08 March 2008 19:23:26 thecommodore6 wrote:
> Albert Zeyer wrote:
> >> // Load tiles.bmp into the temp surface, then convert it to
> >> the format of
> >> gScreen and save it to gTiles, then free the temp surface
> >> SDL_Surface *temp = SDL_LoadBMP("tiles.bmp");
> >> gTiles = SDL_ConvertSurface(temp, gScreen->format,
> >> SDL_SWSURFACE);
> >> SDL_FreeSurface(temp);
> >
> > At which line do you get this error?
> >
> > Is temp != NULL after SDL_LoadBMP ?
> >
> > Is gTiles != NULL after SDL_ConvertSurface ?
>
> This error arises on the line gTiles = SDL_ConvertSurface(...); when I try
> to step over it in the debugger.
>
> After SDL_LoadBMP, temp == NULL, which to me seems like it could be an
> issue, I just don't know how to change that.
>
> I cannot check what gTiles is after SDL_ConvertSurface because the program
> freezes at that line and will not continue.
>
> Is the fact that temp == NULL the issue here? If so, how can I change
> that?
>
> Thank you,
> -rob
If temp is null, doesn't that mean that your tiles.bmp didn't load? So, that's
probably why things are running a muck.
hat are you using for a debugger? Make sure your program is run in the same
directory that contains tiles.bmp. Most debuggers have an option to se t the
working directory. Your other option would be to put the absolute path for
tiles.bmp. If temp is still null with the full path, than SDL_LoadBMP() might
not like your file (??).
Alvin
More information about the SDL
mailing list