[fpc-pascal] Correct way for using TThread.ForceQueue?
pascaldragon at googlemail.com
Tue Apr 26 07:31:22 CEST 2022
Am 25.04.2022 um 17:30 schrieb Michael Van Canneyt via fpc-pascal:
> On Mon, 25 Apr 2022, Thomas Kurz via fpc-pascal wrote:
>> I cannot remember why, but a long time ago when learning Delphi 5 or
>> 6, I
>> have learned not to call the destructor from within any method of the
>> class, only from outside. If this is no longer true nowadays (or maybe,
>> has never been true before), I'd like to use this solution.
> If it is the last thing you do in the method, there is no problem.
> Note that "Free" itself is a method that calls Destroy (the actual
> destructor), so the advice you got was strange to say the least :-)
To be precise: as long as you don't access Self after a Free (this
includes calling virtual methods, but not non-virtual ones) this is no
problem. This has been this way in both FPC and Delphi since the
beginning of TObject.
More information about the fpc-pascal