Alexander Klenin <[email protected]> hat am 27. April 2011 um 18:46 geschrieben: > On Thu, Apr 28, 2011 at 02:14, Graeme Geldenhuys > <[email protected]> wrote: > > > > >From that bug report it looks like a bug in TAChart, not in > > FreeAndNil(). I have written a crap load of components in my time, > > including composite components, and never had a problem with freeing > > children or subcomponents. You just need to do it in the right order, > > and obviously not reference something that is already free'd.> >> > That is quite possible, but neither me nor Martin was unable to find it. > I'd appreciate any specific insight if you have it. FreeThenNil is useful for variables like 'Application', which destructor triggers complex things and/or when the variable is used at a lot of places. During the destruction Application is still valid, so that all components can shut down cleanly. For example they can unregister their handlers. But FreeThenNil is more limited than FreeAndNil. For example you can not use it with multithreading, because of the small step between freeing the memory and setting the variable to nil. Mattias
-- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
