[fpc-pascal] gtree - Freeing a nil Root without error

Marco van de Voort marcov at stack.nl
Tue Jan 7 21:27:16 CET 2014


In our previous episode, Daniel Gaspary said:
>    gtree.TTree type has the following code:
> 
> How is possible then that the following program don't raise an error
> when the destructor (via free) is called?

Free only calls the destructor if self isn't nil.
 

      procedure TObject.Free;

        begin
           // the call via self avoids a warning
           if self<>nil then
             self.destroy;
        end;



More information about the fpc-pascal mailing list