Re: Re[6]: [fpc-pascal] TIniFile crash/memory loss

2011-04-02 Thread Bart
On 4/1/11, DaWorm wrote: > On Fri, Apr 1, 2011 at 9:09 AM, Bart wrote: > It > seems to me like a lot of effort to trap something that will rarely > happen. But it does happen. I don't mind that it raises an exception in Destroy (although I find it rather odd), but the consequences of raising t

Re[8]: [fpc-pascal] TIniFile crash/memory loss

2011-04-01 Thread José Mejuto
Hello FPC-Pascal, Friday, April 1, 2011, 2:45:38 PM, you wrote: D> On Fri, Apr 1, 2011 at 6:28 AM, José Mejuto wrote: >> An exception in free is an extreme rare condition, but it could >> happend, and is better that your software stops to work than notify 2 >> years later that your 2 zillions of

Re: Re[6]: [fpc-pascal] TIniFile crash/memory loss

2011-04-01 Thread DaWorm
On Fri, Apr 1, 2011 at 9:09 AM, Bart wrote: >> The test case was an invalid filename.  Is this the primary failure >> method? > > This was merely to demonstrate the possibility of the destructor failing. What other things would make the destructor of the TIniFile fail? It seems to me like a lot

Re: Re[6]: [fpc-pascal] TIniFile crash/memory loss

2011-04-01 Thread Bart
On 4/1/11, DaWorm wrote: > The test case was an invalid filename. Is this the primary failure > method? This was merely to demonstrate the possibility of the destructor failing. Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://l

Re: Re[6]: [fpc-pascal] TIniFile crash/memory loss

2011-04-01 Thread DaWorm
On Fri, Apr 1, 2011 at 6:28 AM, José Mejuto wrote: > An exception in free is an extreme rare condition, but it could > happend, and is better that your software stops to work than notify 2 > years later that your 2 zillions of INI files were not written at all > because the user write a non valid

Re[6]: [fpc-pascal] TIniFile crash/memory loss

2011-04-01 Thread José Mejuto
Hello FPC-Pascal, Friday, April 1, 2011, 9:58:24 AM, you wrote: MVC> 2. Cache the updates, and make sure they are written when the instance is destroyed. MVC> This is the current behaviour. It works fast, but the corner case you encountered MVC> (an error when updating the file in the d

Re: Re[4]: [fpc-pascal] TIniFile crash/memory loss

2011-04-01 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said: > Going back to 1 is not an option. > For case 2, I am inclined to say that the destructor must always succeed. > Errors in destructors are very ugly to trap. ... time to mark tinifile as deprecated ? _

Re: Re[4]: [fpc-pascal] TIniFile crash/memory loss

2011-04-01 Thread Michael Van Canneyt
On Fri, 1 Apr 2011, Bart wrote: On 3/31/11, José Mejuto wrote: B> This however means that the programmer has to protect TIniFile.Free B> with a Try..Except block, which is also rather unusual. It's unusual, but there is an error, or the class does not perform the save in the free procedure

Re[6]: [fpc-pascal] TIniFile crash/memory loss

2011-04-01 Thread José Mejuto
Hello FPC-Pascal, Friday, April 1, 2011, 12:17:30 AM, you wrote: B> The job of the destructor, however, is to clean up the object and return memory. B> This should never fail IMHO. The clean up has not been successfully performed as in this class a file update is part of the clean up. There are

Re: Re[4]: [fpc-pascal] TIniFile crash/memory loss

2011-03-31 Thread Bart
On 3/31/11, José Mejuto wrote: > B> This however means that the programmer has to protect TIniFile.Free > B> with a Try..Except block, which is also rather unusual. > > It's unusual, but there is an error, or the class does not perform the > save in the free procedure and uses a "flush" (forced) o

Re[4]: [fpc-pascal] TIniFile crash/memory loss

2011-03-31 Thread José Mejuto
Hello FPC-Pascal, Thursday, March 31, 2011, 6:52:26 PM, you wrote: B> This however means that the programmer has to protect TIniFile.Free B> with a Try..Except block, which is also rather unusual. It's unusual, but there is an error, or the class does not perform the save in the free procedure a

Re: Re[2]: [fpc-pascal] TIniFile crash/memory loss

2011-03-31 Thread Bart
This however means that the programmer has to protect TIniFile.Free with a Try..Except block, which is also rather unusual. Bart On 3/31/11, José Mejuto wrote: > Hello FPC-Pascal, > > Thursday, March 31, 2011, 5:05:35 PM, you wrote: > >>> Should I report this behaviour as a bug, or is it conside

Re[2]: [fpc-pascal] TIniFile crash/memory loss

2011-03-31 Thread José Mejuto
Hello FPC-Pascal, Thursday, March 31, 2011, 5:05:35 PM, you wrote: >> Should I report this behaviour as a bug, or is it considered "by design"? >> (My old Delphi does not support the CacheUpdates property, so I cannot >> test how it behaves in Delphi) mvwb> Please report it as a bug. Your fix pro

Re: [fpc-pascal] TIniFile crash/memory loss

2011-03-31 Thread michael . vancanneyt
On Thu, 31 Mar 2011, Bart wrote: When you use TIniFile with CacheUpdates := true, then when you free the TIniFile an error can occur if the component was unable to update the changes (in UpdateFile), this will then raise an exception, which in turn will lead to not calling inherited Destroy, t

[fpc-pascal] TIniFile crash/memory loss

2011-03-31 Thread Bart
When you use TIniFile with CacheUpdates := true, then when you free the TIniFile an error can occur if the component was unable to update the changes (in UpdateFile), this will then raise an exception, which in turn will lead to not calling inherited Destroy, thus leading to memory loss, which cann