summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2012-10-26 10:27:20 +0100
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2012-10-26 10:27:20 +0100
commitd3c3df0093c1b031899ecf3f4ca2db60d4547fe7 (patch)
tree9be0bcd81bfe4fd79637819a621ca2133499c416
parent942df949b0e419667994776c0f2ff04530d0c274 (diff)
downloadfpGUI-d3c3df0093c1b031899ecf3f4ca2db60d4547fe7.tar.xz
demo: Fixes memory leak in Splash Form demo
The splash form itself was never freed.
-rw-r--r--examples/gui/splashscreen/frm_splashscreen.pas10
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/gui/splashscreen/frm_splashscreen.pas b/examples/gui/splashscreen/frm_splashscreen.pas
index 30dff1c9..61f1efa2 100644
--- a/examples/gui/splashscreen/frm_splashscreen.pas
+++ b/examples/gui/splashscreen/frm_splashscreen.pas
@@ -17,6 +17,7 @@ type
lblName1: TfpgLabel;
{@VFD_HEAD_END: SplashForm}
tmr: TfpgTimer;
+ procedure SplashFormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure SplashFormShow(Sender: TObject);
procedure TimerFired(Sender: TObject);
procedure SplashFormClick(Sender: TObject);
@@ -39,6 +40,11 @@ begin
TimerFired(nil);
end;
+procedure TSplashForm.SplashFormClose(Sender: TObject; var CloseAction: TCloseAction);
+begin
+ CloseAction := caFree;
+end;
+
procedure TSplashForm.SplashFormShow(Sender: TObject);
begin
tmr.Enabled := True;
@@ -48,8 +54,7 @@ procedure TSplashForm.TimerFired(Sender: TObject);
begin
tmr.Enabled := False;
tmr.Free;
-// writeln('Timer fired');
- Hide;
+ Close;
end;
constructor TSplashForm.Create(AOwner: TComponent);
@@ -63,6 +68,7 @@ begin
OnShow := @SplashFormShow;
OnClick := @SplashFormClick;
+ OnClose := @SplashFormClose;
end;
procedure TSplashForm.AfterCreate;