aboutsummaryrefslogtreecommitdiffstats
path: root/src/menu
diff options
context:
space:
mode:
authortobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-05-03 16:36:52 +0000
committertobigun <tobigun@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-05-03 16:36:52 +0000
commitcb9c992abfc5c003b020f97f1384bc7c0e346534 (patch)
treefec7af57ef6d7e24f8451d48b3123e181e8f43a9 /src/menu
parent9256b21515b03d1d39013930cce4401b4dd3f8a0 (diff)
downloadusdx-cb9c992abfc5c003b020f97f1384bc7c0e346534.tar.gz
usdx-cb9c992abfc5c003b020f97f1384bc7c0e346534.tar.xz
usdx-cb9c992abfc5c003b020f97f1384bc7c0e346534.zip
- Free Statics/Buttons/Texts if a screen is destroyed (Textures used by those components are not unloaded yet)
- Use Free() instead of Destroy() as it checks for nil by default git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2334 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--src/menu/UMenu.pas25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/menu/UMenu.pas b/src/menu/UMenu.pas
index dd4f257e..6bceef62 100644
--- a/src/menu/UMenu.pas
+++ b/src/menu/UMenu.pas
@@ -206,11 +206,22 @@ uses
UMenuBackgroundFade;
destructor TMenu.Destroy;
+var
+ I: integer;
begin
- if (Background <> nil) then
- begin
- Background.Destroy;
- end;
+ for I := 0 to High(Button) do
+ Button[I].Free;
+ for I := 0 to High(ButtonCollection) do
+ ButtonCollection[I].Free;
+ for I := 0 to High(SelectsS) do
+ SelectsS[I].Free;
+ for I := 0 to High(Text) do
+ Text[I].Free;
+ for I := 0 to High(Statics) do
+ Statics[I].Free;
+
+ Background.Free;
+
//Log.LogError('Unloaded Succesful: ' + ClassName);
inherited;
end;
@@ -379,11 +390,7 @@ procedure TMenu.AddBackground(ThemedSettings: TThemeBackground);
end;
begin
- if (Background <> nil) then
- begin
- Background.Destroy;
- Background := nil;
- end;
+ FreeAndNil(Background);
case ThemedSettings.BGType of
bgtAuto: begin //Automaticly choose one out of BGT_Texture, BGT_Video or BGT_Color