--- a/hedgewars/uVariables.pas Thu Sep 10 18:50:39 2015 +0200
+++ b/hedgewars/uVariables.pas Fri Sep 11 05:54:17 2015 +0200
@@ -2493,6 +2493,7 @@
procedure initModule;
var s: shortstring;
+ i: integer;
begin
cLocale:= cLocaleFName;
SplitByChar(cLocale, s, '.');
@@ -2707,6 +2708,43 @@
AprilOne := false;
ChatPasteBuffer:= '';
+
+ // initialize pointers to nil
+ // (don't rely on implicit init of fpc, because that one only happens ONCE when used as lib)
+ CurAmmoGear:= nil;
+ lastGearByUID:= nil;
+ GearsList:= nil;
+ CurrentTeam:= nil;
+ PreviousTeam:= nil;
+ CurrentHedgehog:= nil;
+ FollowGear:= nil;
+ lastVisualGearByUID:= nil;
+
+ ChefHatTexture:= nil;
+ CrosshairTexture:= nil;
+ GenericHealthTexture:= nil;
+ WeaponTooltipTex:= nil;
+ HHTexture:= nil;
+ LandBackSurface:= nil;
+ ConfirmTexture:= nil;
+ MissionIcons:= nil;
+ ropeIconTex:= nil;
+
+ for i:= Low(ClansArray) to High(ClansArray) do
+ begin
+ ClansArray[i]:= nil;
+ end;
+
+ for i:= Low(TeamsArray) to High(TeamsArray) do
+ begin
+ TeamsArray[i]:= nil;
+ end;
+
+ for i:= Low(CountTexz) to High(CountTexz) do
+ begin
+ CountTexz[i]:= nil;
+ end;
+
end;
procedure freeModule;