--- a/hedgewars/hwengine.pas Mon Mar 22 13:44:35 2010 +0000
+++ b/hedgewars/hwengine.pas Mon Mar 22 17:48:19 2010 +0000
@@ -153,13 +153,15 @@
WriteLnToConsole('Freeing resources...');
if isSoundEnabled then ReleaseSound();
StoreRelease();
+ FreeGearsList();
+ FreeVisualGears;
FreeLand();
ControllerClose();
SendKB();
CloseIPC();
+ freeEverything();
TTF_Quit();
SDL_Quit();
- freeEverything();
exit();
end;
--- a/hedgewars/uGears.pas Mon Mar 22 13:44:35 2010 +0000
+++ b/hedgewars/uGears.pas Mon Mar 22 17:48:19 2010 +0000
@@ -2271,7 +2271,7 @@
procedure freeModule;
begin
- FreeGearsList();
+
end;
end.
--- a/hedgewars/uLand.pas Mon Mar 22 13:44:35 2010 +0000
+++ b/hedgewars/uLand.pas Mon Mar 22 17:48:19 2010 +0000
@@ -862,8 +862,6 @@
procedure freeModule;
begin
FillChar(LandPixels, sizeof(TLandArray), 0);
- if LandBackSurface <> nil then
- SDL_FreeSurface(LandBackSurface);
end;
end.
--- a/hedgewars/uLandTexture.pas Mon Mar 22 13:44:35 2010 +0000
+++ b/hedgewars/uLandTexture.pas Mon Mar 22 17:48:19 2010 +0000
@@ -122,6 +122,9 @@
FreeTexture(tex);
tex:= nil;
end;
+
+if LandBackSurface <> nil then
+ SDL_FreeSurface(LandBackSurface);
end;
end.
--- a/hedgewars/uScript.pas Mon Mar 22 13:44:35 2010 +0000
+++ b/hedgewars/uScript.pas Mon Mar 22 17:48:19 2010 +0000
@@ -719,6 +719,7 @@
begin
// initialize lua
luaState:= lua_open;
+TryDo(luaState <> nil, 'lua_open failed', true);
// open internal libraries
luaopen_base(luaState);
--- a/hedgewars/uTeams.pas Mon Mar 22 13:44:35 2010 +0000
+++ b/hedgewars/uTeams.pas Mon Mar 22 17:48:19 2010 +0000
@@ -474,15 +474,7 @@
end;
procedure freeModule;
-var i: LongWord;
begin
- if TeamsCount > 0 then
- begin
- for i:= 0 to Pred(TeamsCount) do Dispose(TeamsArray[i]);
- for i:= 0 to Pred(ClansCount) do Dispose(ClansArray[i]);
- end;
- TeamsCount:= 0;
- ClansCount:= 0
end;
end.
--- a/hedgewars/uVisualGears.pas Mon Mar 22 13:44:35 2010 +0000
+++ b/hedgewars/uVisualGears.pas Mon Mar 22 17:48:19 2010 +0000
@@ -60,6 +60,7 @@
procedure DeleteVisualGear(Gear: PVisualGear);
procedure AddClouds;
procedure AddDamageTag(X, Y, Damage, Color: LongWord);
+procedure FreeVisualGears;
var VisualGearsList: PVisualGear;
vobFrameTicks, vobFramesCount: Longword;
@@ -745,6 +746,11 @@
AddVisualGear( - cScreenWidth + i * ((cScreenWidth * 2 + (LAND_WIDTH+256)) div (cCloudsNumber + 1)), LAND_HEIGHT-1184, vgtCloud)
end;
+procedure FreeVisualGears;
+begin
+ while VisualGearsList <> nil do DeleteVisualGear(VisualGearsList);
+end;
+
procedure initModule;
begin
VisualGearsList:= nil;
@@ -752,7 +758,6 @@
procedure freeModule;
begin
- while VisualGearsList <> nil do DeleteVisualGear(VisualGearsList);
end;
end.
--- a/hedgewars/uWorld.pas Mon Mar 22 13:44:35 2010 +0000
+++ b/hedgewars/uWorld.pas Mon Mar 22 17:48:19 2010 +0000
@@ -923,7 +923,8 @@
procedure HideMission;
begin
- missionTimer:= 0
+ missionTimer:= 0;
+ if missionTex <> nil then FreeTexture(missionTex);
end;
procedure ShakeCamera(amount: LongWord);
@@ -957,7 +958,6 @@
procedure freeModule;
begin
- if missionTex <> nil then FreeTexture(missionTex);
end;
end.