[Lazarus] Difference between FreeThenNil and FreeAndNil

Graeme Geldenhuys graemeg.lists at gmail.com
Wed Apr 27 12:38:13 CEST 2011

2011/4/27  <michael.vancanneyt@****>:
> begin
>  MyForm.Something;
> end;
> and then somewhere
>  FreeAndNil(MyForm);
> Which is simply wrong coding in the destructor.
> I don't think you should provide for this. This is encouraging people to
> write bad code. They should get an error, and correct their code.

That is just bad coding. Fix the problem at the source, in stead of
simply offering bandaids to encourage the developer to continue such
bad practices.

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the Lazarus mailing list