[fpc-pascal] methods of an object to create others objects

Graeme Geldenhuys graemeg.lists at gmail.com
Tue Jul 6 23:37:06 CEST 2010

On 6 July 2010 18:42, Andrew Brunner <andrew.t.brunner at gmail.com> wrote:
>>> Nope. If Obj2 failed to create you will have a problem with Obj2.Free.
>> Nope. That's why it is free and not destroy.
> Double Nope.  You cannot access methods of a nil object.  Nil.Free
> will in-it-and-of-it cause a read access violation.

Wrong again Andrew. Calling .Free is safe (even if the instance
variable is nil) because internally it checks if the instance exists
before continuing with calling .Destroy on that instance.  Delphi 101.

  - Graeme -

fpGUI - a cross-platform Free Pascal GUI toolkit

More information about the fpc-pascal mailing list