--- a/hedgewars/uStore.pas Thu Jun 17 11:42:23 2010 -0400
+++ b/hedgewars/uStore.pas Thu Jun 17 19:57:51 2010 +0200
@@ -250,6 +250,7 @@
TryDo(flagsurf <> nil, 'Failed to load flag "' + Flag + '" as well as the default flag', true);
copyToXY(flagsurf, texsurf, 2, 2);
SDL_FreeSurface(flagsurf);
+ flagsurf:= nil;
// restore black border pixels inside the flag
PLongwordArray(texsurf^.pixels)^[32 * 2 + 2]:= cNearBlackColor;
@@ -259,7 +260,6 @@
FlagTex:= Surface2Tex(texsurf, false);
SDL_FreeSurface(texsurf);
- texsurf:= nil;
dec(drY, r.h + 2);
DrawHealthY:= drY;
@@ -274,25 +274,27 @@
texsurf:= LoadImage(Pathz[ptHats] + '/Reserved/' + Copy(Hat,9,Length(s)-8), ifNone)
else
texsurf:= LoadImage(Pathz[ptHats] + '/' + Hat, ifNone);
- if texsurf <> nil then
+ if texsurf <> nil then
begin
- HatTex:= Surface2Tex(texsurf, true);
- SDL_FreeSurface(texsurf)
- end
+ HatTex:= Surface2Tex(texsurf, true);
+ SDL_FreeSurface(texsurf)
+ end;
+ texsurf:= nil;
end
end;
end;
MissionIcons:= LoadImage(Pathz[ptGraphics] + '/missions', ifCritical);
iconsurf:= SDL_CreateRGBSurface(SDL_SWSURFACE, 28, 28, 32, RMask, GMask, BMask, AMask);
- if iconsurf <> nil then
+ if iconsurf <> nil then
begin
- r.x:= 0;
- r.y:= 0;
- r.w:= 28;
- r.h:= 28;
- DrawRoundRect(@r, cWhiteColor, cNearBlackColor, iconsurf, true);
- ropeIconTex:= Surface2Tex(iconsurf, false);
- SDL_FreeSurface(iconsurf)
+ r.x:= 0;
+ r.y:= 0;
+ r.w:= 28;
+ r.h:= 28;
+ DrawRoundRect(@r, cWhiteColor, cNearBlackColor, iconsurf, true);
+ ropeIconTex:= Surface2Tex(iconsurf, false);
+ SDL_FreeSurface(iconsurf);
+ iconsurf:= nil;
end;
end;
@@ -816,8 +818,10 @@
for ii:= Low(TSprite) to High(TSprite) do
begin
FreeTexture(SpritesData[ii].Texture);
+ SpritesData[ii].Texture:= nil;
if SpritesData[ii].Surface <> nil then
- SDL_FreeSurface(SpritesData[ii].Surface)
+ SDL_FreeSurface(SpritesData[ii].Surface);
+ SpritesData[ii].Surface:= nil;
end;
SDL_FreeSurface(MissionIcons);
FreeTexture(ropeIconTex);