Re: [fpc-pascal] Checking if a TStringList already exists

2019-05-21 Thread Michael Van Canneyt
On Tue, 21 May 2019, Mattias Gaertner via fpc-pascal wrote: On Tue, 21 May 2019 16:47:28 +0100 Graeme Geldenhuys wrote: [...] I fully agree with what Michael said. You can't truly expect applications developer to trail and error what needs to be done. It's an LCL issue that the Lazarus

Re: [fpc-pascal] Checking if a TStringList already exists

2019-05-21 Thread Mattias Gaertner via fpc-pascal
On Tue, 21 May 2019 16:47:28 +0100 Graeme Geldenhuys wrote: >[...] > I fully agree with what Michael said. You can't truly expect > applications developer to trail and error what needs to be done. It's > an LCL issue that the Lazarus project needs to fix. Delphi's VCL, > fpGUI Toolkit and

Re: [fpc-pascal] Checking if a TStringList already exists

2019-05-21 Thread Michael Van Canneyt
On Tue, 21 May 2019, Giuliano Colla wrote: 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

Re: [fpc-pascal] Checking if a TStringList already exists

2019-05-21 Thread Giuliano Colla
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

Re: [fpc-pascal] Checking if a TStringList already exists

2019-05-21 Thread Sven Barth via fpc-pascal
James Richters schrieb am Di., 21. Mai 2019, 15:48: > I don’t seem to have FreeThenNil I’m using FPC 3.0.4RC1 I don’t use > Lazarus.. maybe it’s a Lazarus thing… or maybe it’s in a different unit > Correct, it's part of Lazarus. Regards, Sven > ___

Re: [fpc-pascal] Checking if a TStringList already exists

2019-05-21 Thread James Richters
Colla Sent: Monday, May 20, 2019 6:01 PM To: fpc-pascal@lists.freepascal.org Subject: Re: [fpc-pascal] Checking if a TStringList already exists Il 20/05/2019 15:23, James Richters ha scritto: Thank you very much for the explanation and examples of this! I am glad you pointed out the FreeAndNill() f

Re: [fpc-pascal] Checking if a TStringList already exists

2019-05-21 Thread Michael Van Canneyt
On Tue, 21 May 2019, Graeme Geldenhuys wrote: On 20/05/2019 11:01 pm, Giuliano Colla wrote: In some rare case when dealing with complex objects you might need FreeThenNil() in place of FreeAndNil(). As far as I'm concerned, that is such a broken concept! The developer already has the

Re: [fpc-pascal] Checking if a TStringList already exists

2019-05-21 Thread Graeme Geldenhuys
On 20/05/2019 11:01 pm, Giuliano Colla wrote: > In some rare case when dealing with complex objects you might need > FreeThenNil() in place of FreeAndNil(). As far as I'm concerned, that is such a broken concept! The developer already has the burden to free any memory that he/she allocates. With

Re: [fpc-pascal] Checking if a TStringList already exists

2019-05-20 Thread Sven Barth via fpc-pascal
James Richters schrieb am Mo., 20. Mai 2019, 15:23: > Thank you very much for the explanation and examples of this! I am glad > you pointed out the FreeAndNill() function, I will defiantly be needing > that. > Though you need to keep in mind that only that single variable will be set to Nil.

Re: [fpc-pascal] Checking if a TStringList already exists

2019-05-20 Thread Giuliano Colla
Il 20/05/2019 15:23, James Richters ha scritto: Thank you very much for the explanation and examples of this! I am glad you pointed out the FreeAndNill() function, I will defiantly be needing that. James Then you might also appreciate the function

Re: [fpc-pascal] Checking if a TStringList already exists

2019-05-20 Thread James Richters
discussions Subject: Re: [fpc-pascal] Checking if a TStringList already exists On Mon, 20 May 2019, James Richters wrote: > I’m wondering if there is a way to test if a tstringlinst has been created > yet? > > > > I looked at the documentation in these two locations: &

Re: [fpc-pascal] Checking if a TStringList already exists

2019-05-20 Thread Michael Van Canneyt
On Mon, 20 May 2019, James Richters wrote: I’m wondering if there is a way to test if a tstringlinst has been created yet? I looked at the documentation in these two locations: https://lazarus-ccr.sourceforge.io/docs/rtl/classes/tstringlist.html and

[fpc-pascal] Checking if a TStringList already exists

2019-05-20 Thread James Richters
I’m wondering if there is a way to test if a tstringlinst has been created yet? I looked at the documentation in these two locations: https://lazarus-ccr.sourceforge.io/docs/rtl/classes/tstringlist.html and https://lazarus-ccr.sourceforge.io/docs/rtl/classes/tstrings.html but they do