[Lazarus] Difference between FreeThenNil and FreeAndNil

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Wed Apr 27 09:46:01 CEST 2011

On Wed, 27 Apr 2011, Alexander Klenin wrote:

> On Wed, Apr 27, 2011 at 18:15,  <michael.vancanneyt at wisa.be> wrote:
>>> That's a hack to work around the fact that some destructors may
>>> access the object being destroyed via the given pointer instead of
>>> directly.
>> Can you explain this ?
>> Because to my understanding the code does exactly the same.
> No, these two procedures perform assignment and destruction in a
> different order -- even their names reflect that.

Yes, I have seen that, but why is this relevant ?

I mean, if one does
It really doesn't matter whether the reference MyObject is set to nil before
or after the call to Free ?


More information about the Lazarus mailing list