<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On 16 Oct 2010, at 15:46, Martin Schreiber wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Jonas Maebe wrote:<br><br><blockquote type="cite">He cannot. If freeonterminate=true, then even if you call "inherited</blockquote><blockquote type="cite">create(false)" as the very last statement of your constructor, the thread<br></blockquote><blockquote type="cite">may already have finished running and freed itself before<br></blockquote><blockquote type="cite">AfterConstruction is called. The AfterConstruction call will then crash.<br></blockquote><blockquote type="cite"></blockquote></span></blockquote><div><span class="Apple-style-span" style="border-collapse: separate; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><blockquote type="cite"><br></blockquote></span></div><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Monaco; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Will it crash if it is empty as in TObject?<br></span></blockquote></div><br><div>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.</div><div><br></div><div>Note that in svn trunk, self can no longer be freed before AfterConstruction has been called because of the fix from <a href="http://bugs.freepascal.org/view.php?id=16884">http://bugs.freepascal.org/view.php?id=16884</a>.</div><div><br></div><div><br></div><div>Jonas</div></body></html>