On 16 Oct 2010, at 15:46, Martin Schreiber wrote:

> Jonas Maebe wrote:
> 
>> He cannot. If freeonterminate=true, then even if you call "inherited
>> create(false)" as the very last statement of your constructor, the thread
>> may already have finished running and freed itself before
>> AfterConstruction is called. The AfterConstruction call will then crash.
>> 
> 
> Will it crash if it is empty as in TObject?

The contents of AfterConstruction don't matter. If the instance is freed before 
the constructor had a chance to call AfterConstruction, the self pointer won't 
be valid anymore in the constructor and hence the call to AfterConstruction may 
crash.

Note that in svn trunk, self can no longer be freed before AfterConstruction 
has been called because of the fix from 
http://bugs.freepascal.org/view.php?id=16884.


Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to