From d3c3df0093c1b031899ecf3f4ca2db60d4547fe7 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 26 Oct 2012 10:27:20 +0100 Subject: demo: Fixes memory leak in Splash Form demo The splash form itself was never freed. --- examples/gui/splashscreen/frm_splashscreen.pas | 10 ++++++++-- 1 file 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; -- cgit v1.2.3-70-g09d2