[fpc-pascal] Generic way to pre-maturely exit TCustomApplication without memory leaks

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Thu Oct 13 10:09:11 CEST 2016


On 2016-10-12 20:37, grouchysmurf wrote:
> Say, I have a code, where TH is a Class(TCustomApplication):
> 
>   ph := TH.Create(Nil);
>   ph.Initialize;
>   ph.ProcessOptions;
>   ph.Run;
>   ph.Free;

I would also rewrite that with a try..finally as in:

ph := TH.Create(nil)
try
  ph.Initialize;
  ph.ProcessOptions;
  ph.Run;
finally
  ph.Free;
end;



Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp



More information about the fpc-pascal mailing list