[SDL] Re: Segmentation Fault weirdness..

Willem Jan Palenstijn palenstijn at planet.nl
Sat Jan 22 11:12:51 PST 2005


On Sat, 2005-01-22 at 18:48 +0000, mo wrote:
> Ok, here is a tgz of the files: http://thesilent1.freeownhost.com/sdl003.tgz .
> I compile it with this command: 
> gcc sdl003.c -o sdl003 `sdl-config --cflags --libs`
> but a Makefile is included.

In your SDL_utils.h:

void uDrawSurface(SDL_Surface* src,SDL_Surface* dest,int x,int y,int
w,int h,int x2,int y2){
        SDL_Rect* scoord;
        SDL_Rect* dcoord;


You never initialize those two pointers, so when you set scoord->x/y/w/h
and dcoord->x/y you end up corrupting memory.

-Willem Jan





More information about the SDL mailing list