I working on some code that draws 2 images from 2 separate surfaces together onto another surface and then draws this surface to the screen surface straight after. I'm using 640*480*8 with a set palette. All surfaces have been assigned the same palette. This works the first time round but when it attempts to do it a second time, it crashes the program.

Code:
  Src.X:=0;  Src.Y:=0;  Src.W:=32;  Src.H:=16;
  Dest.X:=0;  Dest.Y:=0;  Dest.W:=32;  Dest.H:=16;
  SDL_BlitSurface(SrcSurf1,@Src,DestSurf,@Dest);
  SDL_BlitSurface(SrcSurf2,@Src,DestSurf,@Dest);
  SDL_BlitSurface(DestSurf,@Src,Screen,@Dest);
  SDL_FLIP(Screen);
  SDL_BlitSurface(SrcSurf1,@Src,DestSurf,@Dest);
  SDL_BlitSurface(SrcSurf2,@Src,DestSurf,@Dest);
  SDL_BlitSurface(DestSurf,@Src,Screen,@Dest);
  SDL_FLIP(Screen);
[EDIT] I've just written a test bed program and it works on this so I guess it must be a problem elsewhere. Disregard this post.