[Lazarus] How to destroy object / component by itself?
Michael Schnell
mschnell at lumino.de
Fri Dec 4 10:27:01 CET 2015
On 12/03/2015 09:26 PM, Krzysztof wrote:
> How to destroy object or component in its own method
You can do a "pseudo-finalizer" method in an object that just ends by
"Free;".
Here you (e.g. ion a thread) can create an object and queue that
function via TThread.Queue, TThread.Synchronize, or
Application.QueueAsyncCall. Now the object is automatically freed
without you needing to bother about saving it (i.e. a pointer to same)
in a variable.
(AFAIK implementing "real" finalizer methods - supposedly just syntax
candy for exactly this) has already been discussed in the FPC developers
message list)
-Michael
More information about the Lazarus
mailing list