In our previous episode, Andrew Brunner said:
> >> > ?obj1.Free;
> >> > ?obj2.Free;
> >> > end;
> >> >
> >> > The objectcs are protected. But is boring... :)
> >> > Everybody codify like that, afraid if resources are not available?
> >> >
> >>
> >> 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.

1. Did you test this? And then debug it?
2. Ask yourself why don't we call .destroy directly, and what the use
   of .free is over .destroy.

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to