Problem freeing components with .free
- From: "TeChNoInSiDe" <tomatinhum@xxxxxxxxx>
- Date: 14 Feb 2007 12:13:27 -0800
Delphi help says:
FREE Method
"Never explicitly free a component within one of its own event
handlers or the event handler of a component it owns or contains. For
example, don't free a button, or the form that owns the button, in its
OnClick event handler."
----------------------------------------------------------------------------------------
In my form I have a image listing section, a save button and a
SaveImages() function associated with save button's onclick handler.
SaveImages() do some saving operations and then destroys (with .free
method) images and the save button. As said in delphi warning, i am
getting access violation after freeing the save button.
I tried to make a SaveButtonHandler for onclick handler and inside it
calling the SaveImages function but seems it has the same effect.
I created a threaded timer and activated it on savebuttonhandler and
then called saveimages() on timer event. This worked great but lead me
to another programming limitations (because of a isolated thread
process).
So, does anybody know any workaround for using .free on this
situation, without using timers?
.
- Follow-Ups:
- Re: Problem freeing components with .free
- From: alanglloyd@xxxxxxx
- Re: Problem freeing components with .free
- From: Rob Kennedy
- Re: Problem freeing components with .free
- From: Sebastian Doht
- Re: Problem freeing components with .free
- Prev by Date: Editor component
- Next by Date: Re: Problem freeing components with .free
- Previous by thread: Editor component
- Next by thread: Re: Problem freeing components with .free
- Index(es):