[fpc-devel] TCustomApplication's parent class?

Graeme Geldenhuys graemeg.lists at gmail.com
Sat Apr 26 11:58:55 CEST 2008


2008/4/26 Vincent Snijders <vsnijders at quicknet.nl>:
>  It most probably is not unknown to you: the most important benefit of being
> TComponent is that you can be owner of other components, so that eases
> memory management. The Application can become responsible for freeing the
> components it owns.


OK, the owner idea is handy, but what other than Forms or DataModules
would Application want to own?

I've just changed fpGUI so that it's Application class descends from
TObject, and maintains an internal list (TList) of objects created via
Application.CreateForm(). I've had constant memory leaks I couldn't
track down, but changing Application to a TObject and maintaining the
internal list myself fixed all the memory leak issues.

Maybe my understanding of TComponent's ability to free owned objects
are lacking. Is there something special I was supposed to do, so that
TComponent can free off any owned objects?

Regards,
 - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/



More information about the fpc-devel mailing list