Forum > General

Break and StringLists

<< < (2/2)

howardpc:
Application.Terminate will not free stringlists you have manually instantiated. How can the Application object possibly know about them?
Don't use OnActivate to create the stringlists, and don't use OnDeactivate to free them.

Create them in the form's OnCreate, and free them in the form's OnDestroy.
If you have to use OnActivate, use it only to check for the existence and validity of the file(s) to which the stringlists correspond, though I would have thought OnCreate was a better place for this check.

If some error is encountered, post a suitable error message and simply call Close to close the main form, which shuts down the app.

This will then free the stringlists correctly through the form's OnDestroy event handler.

Navigation

[0] Message Index

[*] Previous page

Go to full version