Newsgroups : Borland : borland.public.delphi.rtl.win32 : 2005 Aug : "Destroy" and "Finalization" order
| Subject: | "Destroy" and "Finalization" order |
| Posted by: | "John S." (jo..@softsand.com) |
| Date: | 11 Aug 2005 11:19:10 |
I have code that allocates a global structure in the
"Initialization" section of a unit, and frees it in the
"Finalization" section. Also defined in the unit are objects
that in their "Constructor" and "Destructor" methods write
to this globally created (and intialized) structure. When
the application terminates, sometimes (it appears) that the
"Finalization" section is executing BEFORE the object's
"Destructors". This, of course leads to an Access Violation
because the global structure has already been freed. How can
I guarantee that the "Finalization" section is not executed
until AFTER ALL Destructors have completed?
Any help would be appreciated.