[fpc-pascal] Checking if a TStringList already exists

Giuliano Colla giuliano.colla at fastwebnet.it
Tue May 21 17:22:13 CEST 2019

Il 21/05/2019 14:40, Michael Van Canneyt ha scritto:

> FreeThenNil should never be necessary. FreeAndNil() should be enough 
> for all circumstances. 

In a perfect world maybe you're right. But if you're dealing with LCL, 
you'll find it sometimes necessary, less your program segfaults, because 
the freeing of some children is postponed, and when they're set free 
their parent is already dead. Maybe it's a matter of bad design of some 
LCL components or even of TApplication, but either you decide that to 
make your project work you must redesign significant parts of LCL or you 
give up and sadly take advantage of FreeThenNil().


Do not do to others as you would have them do to you.They might have different tastes.

More information about the fpc-pascal mailing list